Compare commits
309 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2eaa9236f2 | |||
| e4bab37b62 | |||
| 105c9c71ee | |||
| e135229ca6 | |||
| 97dea6ede5 | |||
| d871a92d1c | |||
| a152aa125b | |||
| 4e217d4028 | |||
| e5da7a4606 | |||
| faace3090c | |||
| d3e2345f94 | |||
| a3e087ab51 | |||
| 3a614a8ea1 | |||
| 9cb60dcdf5 | |||
| af6db68816 | |||
| 305ed0b65a | |||
| 263efb41e8 | |||
| d6312c7b92 | |||
| b31af4891d | |||
| 0ba08f57f2 | |||
| a2d7881afe | |||
| d79e598bf8 | |||
| a6a39cb842 | |||
| 5d0883c0e4 | |||
| e6d49424cf | |||
| 72abcd5991 | |||
| 9c2bb85858 | |||
| e9b059ee94 | |||
| 7a913844e2 | |||
| f8be7e1f57 | |||
| d5c43c4675 | |||
| 85fa6d8025 | |||
| 6b2a8f54a1 | |||
| bd1fb845b1 | |||
| 9c64c9af5d | |||
| 1057eceb2f | |||
| 445bc75319 | |||
| 4fb7ee02cd | |||
| ad11b7ebd0 | |||
| 5d9bda6f97 | |||
| 54be07c17d | |||
| 2c7ab3a28e | |||
| 3cc3c1bbd3 | |||
| ddedf2e046 | |||
| a60c339f85 | |||
| ce2c5d6528 | |||
| fd81f70355 | |||
| 100bb7c6ca | |||
| 1ffcedd9d4 | |||
| fc1f713106 | |||
| 83c3a78e6d | |||
| e6a3e7024d | |||
| d62fde0d79 | |||
| a70cf464d6 | |||
| 546260348d | |||
| 693aec949c | |||
| 5c7ac1bb7e | |||
| 8862752523 | |||
| 201c380925 | |||
| c7230a6f77 | |||
| 6b78fdf822 | |||
| 3cb326e426 | |||
| d3f9332372 | |||
| be0f6a6af2 | |||
| 25aa233cef | |||
| 5fdc424202 | |||
| 9b74bb5c92 | |||
| 8bf8a649c8 | |||
| 7ba8d8b608 | |||
| e35328fece | |||
| 366d4d7b0b | |||
| 3af1e75084 | |||
| dabd80fe4c | |||
| cb711a648f | |||
| 5b58dbc980 | |||
| 8b3c0a941c | |||
| 3ce29a3d7e | |||
| dc3c6b2f39 | |||
| 1cbee4c504 | |||
| 798e4c288a | |||
| ac39e32bc9 | |||
| 52da7f931b | |||
| fcb6f814de | |||
| 9e6b56d783 | |||
| 923dad6ca8 | |||
| 9f17d91b32 | |||
| 2bcb04a3b1 | |||
| a530b600b8 | |||
| d494a2bee2 | |||
| 6a027662ae | |||
| 577bb7bf31 | |||
| df664bd55f | |||
| 8a2705f81f | |||
| fcaf11422a | |||
| 3444409554 | |||
| 683c01b301 | |||
| e2492f773d | |||
| 1f3a2dcd1d | |||
| 4205cb32c5 | |||
| 6ab9bdb346 | |||
| a4aec1919c | |||
| 5b97d70d57 | |||
| eeeb4596c3 | |||
| 23853cae14 | |||
| 87f6f33b37 | |||
| 8c03d1bdde | |||
| 7f1c7d808d | |||
| be12aece5b | |||
| d7605f1449 | |||
| ef80642dec | |||
| a5622c93d4 | |||
| b6f9bfe9a5 | |||
| 79954657e2 | |||
| 35d3f1f72a | |||
| 388d74faf4 | |||
| 0f8747e194 | |||
| 93f16ba9e3 | |||
| bea2d42e8c | |||
| 68d644fd28 | |||
| f6e33450ff | |||
| 65008c5c0b | |||
| dbfaf568fc | |||
| 58fd6ac03e | |||
| 1e64524afb | |||
| 20a5d8effd | |||
| 8c7e0bcb0a | |||
| c69080f11e | |||
| 5a48c800ee | |||
| c6eff4d373 | |||
| 5c056c2a3e | |||
| 61f593f350 | |||
| 6cc7dc7aaa | |||
| 239f040a98 | |||
| 3827c16fde | |||
| e299343807 | |||
| 4130ce2b93 | |||
| d6acb64514 | |||
| 8e233e2591 | |||
| 9cda16220e | |||
| 36acadbd52 | |||
| 37b6552c42 | |||
| 1903052d79 | |||
| 2b4cfd9a60 | |||
| decbb65f09 | |||
| 8e2ca37edc | |||
| 8fb6bcc8b1 | |||
| 2f36c670ff | |||
| d701c3a480 | |||
| cd7f3375b2 | |||
| 46cd185524 | |||
| e04d82e940 | |||
| 26d0863921 | |||
| 37f23fa537 | |||
| 167d408b5e | |||
| d4a8ff4872 | |||
| fb9b12a982 | |||
| 88a03f1a1d | |||
| ba7e400e13 | |||
| 57f0f88552 | |||
| 42a0cf6283 | |||
| b67acd5ea1 | |||
| 5e2721d2f5 | |||
| 2cd43aee0a | |||
| fb1570d290 | |||
| 79972ad4db | |||
| 61934c285c | |||
| a7d554971c | |||
| e54ea90607 | |||
| fda403a079 | |||
| f2e75c96be | |||
| 322eb2b8a8 | |||
| 6f71183d0e | |||
| 5d852cf6ae | |||
| 2d1ea1618b | |||
| 50723d07a6 | |||
| 1161562bc8 | |||
| 0c8b3aaced | |||
| b81b7decf6 | |||
| e5463330ef | |||
| 17c0b3e460 | |||
| 3bc3193805 | |||
| d6db6dedca | |||
| d931bc72c7 | |||
| 6506f77689 | |||
| 0d64b38dbc | |||
| 7856061cf0 | |||
| 0210e414d2 | |||
| 41231e8ae2 | |||
| ba2e34682e | |||
| b234ff9234 | |||
| 3442cc3d1a | |||
| e618e34c94 | |||
| 105c3b0a4c | |||
| 69d0446019 | |||
| 078045f73b | |||
| 78af1daa2e | |||
| 0bd0d57a81 | |||
| 9dd5b6ce37 | |||
| d862cdaa72 | |||
| 4f57de9688 | |||
| 92b6e05909 | |||
| 2bd0bae2f7 | |||
| 69b5d24f28 | |||
| e5dcb9d9da | |||
| 4db8638f7e | |||
| cec885daf9 | |||
| 90fbf27114 | |||
| f1436cec9b | |||
| cf968cb6b5 | |||
| 2278f40051 | |||
| 18a76d3a87 | |||
| 6a65461ec7 | |||
| a5a0a7c4f3 | |||
| f1e6f8042c | |||
| 848873d87e | |||
| 75bb864237 | |||
| d5275b16aa | |||
| 15d1b6cef0 | |||
| 6d4dd3e17a | |||
| 649c22a34e | |||
| 8d04d39036 | |||
| 0e90c719b0 | |||
| a79526cad8 | |||
| d05d8b6100 | |||
| 9856867954 | |||
| 19064b680e | |||
| 95265c765b | |||
| 1ed8912f57 | |||
| 82a0eb4413 | |||
| be7215402b | |||
| 4500b064d8 | |||
| 93d191d7c9 | |||
| 1607ceaf3e | |||
| 5b24ea9dd9 | |||
| c879dcaf7d | |||
| 86691dabbf | |||
| fe71a66bb9 | |||
| 80e0d848f2 | |||
| 8b3a2984bf | |||
| fccce265aa | |||
| a43a228f78 | |||
| dd8610fd5c | |||
| b991beb712 | |||
| 25f6483488 | |||
| efc0325e14 | |||
| d19ec021fe | |||
| b34a307936 | |||
| fb565caf7b | |||
| 6796e8fff6 | |||
| 213547f545 | |||
| 73851e962b | |||
| de22204514 | |||
| ebba15fe67 | |||
| c1cd3339fa | |||
| 713a296a59 | |||
| 06bde527d5 | |||
| dcd31f5701 | |||
| 65f2af5849 | |||
| 2dd7a8637c | |||
| 211d056728 | |||
| dc0aed5b16 | |||
| 5064df4ba2 | |||
| 469c31da97 | |||
| 5fb41e6ecc | |||
| a68a442bbb | |||
| 84db5644d6 | |||
| fc1fb7a590 | |||
| dc91d4eca8 | |||
| f6a42a36d6 | |||
| 2a769dc0b0 | |||
| 3475bfb2aa | |||
| f9f8fade89 | |||
| e404fb772b | |||
| 2a9412042c | |||
| e8ab661504 | |||
| 3f91db25d4 | |||
| 300381ba4d | |||
| 4363e6a213 | |||
| 450dac4b1e | |||
| 278127fe29 | |||
| 23d71de75f | |||
| d86789898d | |||
| c3dc1f65d4 | |||
| 238fb00727 | |||
| 2d48c81d58 | |||
| 0893e0043f | |||
| 72c0267fe6 | |||
| c9956def36 | |||
| 5d60fe6812 | |||
| 6051dfae30 | |||
| 3518153d5b | |||
| cf949609b2 | |||
| d482a8805c | |||
| 161dc9ce7e | |||
| 090073cc3b | |||
| 6ae718e4d6 | |||
| 783b1cb611 | |||
| 4b01f80e8d | |||
| c8278f377b | |||
| d34b664933 | |||
| c8f40e1d26 | |||
| 185a8d7582 | |||
| 8373e91a1b | |||
| 6aeedfb70c | |||
| e7f3851212 | |||
| 7df05ade4c | |||
| 24b032ce5b | |||
| b6fe4ff637 | |||
| 8f1aa28b37 |
@@ -66,7 +66,6 @@ CINFO3D_VISU::CINFO3D_VISU() :
|
||||
m_boardCenter = SFVEC3F( 0.0f );
|
||||
|
||||
m_boardBoudingBox.Reset();
|
||||
m_board2dBBox3DU.Reset();
|
||||
|
||||
m_layers_container2D.clear();
|
||||
m_layers_holes2D.clear();
|
||||
@@ -462,8 +461,6 @@ void CINFO3D_VISU::createBoardPolygon()
|
||||
errmsg.append( _( "Cannot determine the board outline." ) );
|
||||
wxLogMessage( errmsg );
|
||||
}
|
||||
|
||||
Polygon_Calc_BBox_3DU( m_board_poly, m_board2dBBox3DU, m_biuTo3Dunits );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -550,9 +550,6 @@ class CINFO3D_VISU
|
||||
/// 3d bouding box of the pcb board in 3d units
|
||||
CBBOX m_boardBoudingBox;
|
||||
|
||||
/// 2d bouding box of the pcb board in 3d units
|
||||
CBBOX2D m_board2dBBox3DU;
|
||||
|
||||
/// It contains polygon contours for each layer
|
||||
MAP_POLY m_layers_poly;
|
||||
|
||||
|
||||
@@ -62,13 +62,11 @@
|
||||
static int s_textWidth;
|
||||
static CGENERICCONTAINER2D *s_dstcontainer = NULL;
|
||||
static float s_biuTo3Dunits;
|
||||
static const CBBOX2D *s_boardBBox3DU = NULL;
|
||||
static const BOARD_ITEM *s_boardItem = NULL;
|
||||
|
||||
// This is a call back function, used by DrawGraphicText to draw the 3D text shape:
|
||||
void addTextSegmToContainer( int x0, int y0, int xf, int yf, void* aData )
|
||||
{
|
||||
wxASSERT( s_boardBBox3DU != NULL );
|
||||
wxASSERT( s_dstcontainer != NULL );
|
||||
|
||||
const SFVEC2F start3DU( x0 * s_biuTo3Dunits, -y0 * s_biuTo3Dunits );
|
||||
@@ -76,7 +74,7 @@ void addTextSegmToContainer( int x0, int y0, int xf, int yf, void* aData )
|
||||
|
||||
if( Is_segment_a_circle( start3DU, end3DU ) )
|
||||
s_dstcontainer->Add( new CFILLEDCIRCLE2D( start3DU,
|
||||
s_textWidth * s_biuTo3Dunits,
|
||||
( s_textWidth / 2 ) * s_biuTo3Dunits,
|
||||
*s_boardItem) );
|
||||
else
|
||||
s_dstcontainer->Add( new CROUNDSEGMENT2D( start3DU,
|
||||
@@ -103,7 +101,6 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const TEXTE_PCB* aTextPCB,
|
||||
s_dstcontainer = aDstContainer;
|
||||
s_textWidth = aTextPCB->GetThickness() + ( 2 * aClearanceValue );
|
||||
s_biuTo3Dunits = m_biuTo3Dunits;
|
||||
s_boardBBox3DU = &m_board2dBBox3DU;
|
||||
|
||||
// not actually used, but needed by DrawGraphicText
|
||||
const COLOR4D dummy_color = COLOR4D::BLACK;
|
||||
@@ -228,7 +225,6 @@ void CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer( const MODULE* aMod
|
||||
s_boardItem = (const BOARD_ITEM *)&aModule->Value();
|
||||
s_dstcontainer = aDstContainer;
|
||||
s_biuTo3Dunits = m_biuTo3Dunits;
|
||||
s_boardBBox3DU = &m_board2dBBox3DU;
|
||||
|
||||
for( unsigned ii = 0; ii < texts.size(); ++ii )
|
||||
{
|
||||
@@ -390,9 +386,22 @@ void CINFO3D_VISU::createNewPadWithClearance( const D_PAD* aPad,
|
||||
case PAD_SHAPE_RECT:
|
||||
{
|
||||
// see pcbnew/board_items_to_polygon_shape_transform.cpp
|
||||
|
||||
wxPoint corners[4];
|
||||
aPad->BuildPadPolygon( corners, wxSize( 0, 0), aPad->GetOrientation() );
|
||||
bool drawOutline;
|
||||
|
||||
// For aClearanceValue.x == aClearanceValue.y and > 0 we use the pad shape
|
||||
// and draw outlines with thicknes = aClearanceValue.
|
||||
// Otherwise we draw only the inflated/deflated shape
|
||||
if( aClearanceValue.x > 0 && aClearanceValue.x == aClearanceValue.y )
|
||||
{
|
||||
drawOutline = true;
|
||||
aPad->BuildPadPolygon( corners, wxSize( 0, 0 ), aPad->GetOrientation() );
|
||||
}
|
||||
else
|
||||
{
|
||||
drawOutline = false;
|
||||
aPad->BuildPadPolygon( corners, aClearanceValue, aPad->GetOrientation() );
|
||||
}
|
||||
|
||||
SFVEC2F corners3DU[4];
|
||||
|
||||
@@ -420,20 +429,23 @@ void CINFO3D_VISU::createNewPadWithClearance( const D_PAD* 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( drawOutline )
|
||||
{
|
||||
if( Is_segment_a_circle( corners3DU[i - 1], corners3DU[i & 3] ) )
|
||||
for( int i = 1; i <= 4; i++ )
|
||||
{
|
||||
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 ) );
|
||||
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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1085,7 +1085,10 @@ bool EDA_3D_CANVAS::SetView3D( int aKeycode )
|
||||
m_settings.CameraGet().SetT0_and_T1_current_T();
|
||||
m_settings.CameraGet().Reset_T1();
|
||||
m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
|
||||
m_settings.CameraGet().RotateZ_T1( glm::radians( -180.0f ) );
|
||||
// The rotation angle should be 180.
|
||||
// We use 179.999 (180 - epsilon) to avoid a full 360 deg rotation when
|
||||
// using 180 deg if the previous rotated position was already 180 deg
|
||||
m_settings.CameraGet().RotateZ_T1( glm::radians( -179.999f ) );
|
||||
request_start_moving_camera();
|
||||
return true;
|
||||
|
||||
@@ -1101,7 +1104,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().RotateY_T1( glm::radians( 179.999f ) ); // Rotation = 180-epsilon
|
||||
request_start_moving_camera(
|
||||
glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
|
||||
return true;
|
||||
|
||||
@@ -198,6 +198,7 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
|
||||
0.00f, 0.30f );
|
||||
|
||||
m_materials.m_Copper.m_Shininess = shininessfactor * 128.0f;
|
||||
m_materials.m_Copper.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
|
||||
// Paste material mixed with paste color
|
||||
@@ -213,6 +214,7 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
|
||||
m_settings.m_SolderPasteColor.b );
|
||||
|
||||
m_materials.m_Paste.m_Shininess = 0.1f * 128.0f;
|
||||
m_materials.m_Paste.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
|
||||
// Silk screen material mixed with silk screen color
|
||||
@@ -228,6 +230,7 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
|
||||
m_settings.m_SilkScreenColor.b + 0.10f );
|
||||
|
||||
m_materials.m_SilkS.m_Shininess = 0.078125f * 128.0f;
|
||||
m_materials.m_SilkS.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
|
||||
// Solder mask material mixed with solder mask color
|
||||
@@ -244,6 +247,7 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
|
||||
|
||||
m_materials.m_SolderMask.m_Shininess = 0.8f * 128.0f;
|
||||
m_materials.m_SolderMask.m_Transparency = 0.17f;
|
||||
m_materials.m_SolderMask.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
|
||||
// Epoxy material
|
||||
@@ -258,6 +262,7 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
|
||||
20.0f / 255.0f );
|
||||
|
||||
m_materials.m_EpoxyBoard.m_Shininess = 0.1f * 128.0f;
|
||||
m_materials.m_EpoxyBoard.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
}
|
||||
else // Technical Mode
|
||||
{
|
||||
@@ -269,34 +274,40 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
|
||||
m_materials.m_Copper.m_Ambient = matAmbientColor;
|
||||
m_materials.m_Copper.m_Specular = matSpecularColor;
|
||||
m_materials.m_Copper.m_Shininess = matShininess;
|
||||
m_materials.m_Copper.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Paste material
|
||||
m_materials.m_Paste.m_Ambient = matAmbientColor;
|
||||
m_materials.m_Paste.m_Specular = matSpecularColor;
|
||||
m_materials.m_Paste.m_Shininess = matShininess;
|
||||
m_materials.m_Paste.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Silk screen material
|
||||
m_materials.m_SilkS.m_Ambient = matAmbientColor;
|
||||
m_materials.m_SilkS.m_Specular = matSpecularColor;
|
||||
m_materials.m_SilkS.m_Shininess = matShininess;
|
||||
m_materials.m_SilkS.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Solder mask material
|
||||
m_materials.m_SolderMask.m_Ambient = matAmbientColor;
|
||||
m_materials.m_SolderMask.m_Specular = matSpecularColor;
|
||||
m_materials.m_SolderMask.m_Shininess = matShininess;
|
||||
m_materials.m_SolderMask.m_Transparency = 0.17f;
|
||||
m_materials.m_SolderMask.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Epoxy material
|
||||
m_materials.m_EpoxyBoard.m_Ambient = matAmbientColor;
|
||||
m_materials.m_EpoxyBoard.m_Diffuse = m_settings.m_BoardBodyColor;
|
||||
m_materials.m_EpoxyBoard.m_Specular = matSpecularColor;
|
||||
m_materials.m_EpoxyBoard.m_Shininess = matShininess;
|
||||
m_materials.m_EpoxyBoard.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Gray material (used for example in technical vias and pad holes)
|
||||
m_materials.m_GrayMaterial.m_Ambient = SFVEC3F( 0.8f, 0.8f, 0.8f );
|
||||
m_materials.m_GrayMaterial.m_Diffuse = SFVEC3F( 0.3f, 0.3f, 0.3f );
|
||||
m_materials.m_GrayMaterial.m_Specular = SFVEC3F( 0.4f, 0.4f, 0.4f );
|
||||
m_materials.m_GrayMaterial.m_Shininess = 0.01f * 128.0f;
|
||||
m_materials.m_GrayMaterial.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,6 +358,7 @@ void C3D_RENDER_OGL_LEGACY::set_layer_material( PCB_LAYER_ID aLayerID )
|
||||
m_materials.m_Plastic.m_Diffuse.b * 0.7f );
|
||||
|
||||
m_materials.m_Plastic.m_Shininess = 0.078125f * 128.0f;
|
||||
m_materials.m_Plastic.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
OGL_SetMaterial( m_materials.m_Plastic );
|
||||
break;
|
||||
|
||||
|
||||
@@ -286,7 +286,9 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
|
||||
|
||||
m_outlineBoard2dObjects = new CCONTAINER2D;
|
||||
|
||||
if( ((const SHAPE_POLY_SET &)m_settings.GetBoardPoly()).OutlineCount() == 1 )
|
||||
const int outlineCount = m_settings.GetBoardPoly().OutlineCount();
|
||||
|
||||
if( outlineCount > 0 )
|
||||
{
|
||||
float divFactor = 0.0f;
|
||||
|
||||
@@ -299,12 +301,16 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
|
||||
SHAPE_POLY_SET boardPolyCopy = m_settings.GetBoardPoly();
|
||||
boardPolyCopy.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
|
||||
boardPolyCopy,
|
||||
*m_outlineBoard2dObjects,
|
||||
m_settings.BiuTo3Dunits(),
|
||||
divFactor,
|
||||
(const BOARD_ITEM &)*m_settings.GetBoard() );
|
||||
for( int iOutlinePolyIdx = 0; iOutlinePolyIdx < outlineCount; iOutlinePolyIdx++ )
|
||||
{
|
||||
Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
|
||||
boardPolyCopy,
|
||||
*m_outlineBoard2dObjects,
|
||||
m_settings.BiuTo3Dunits(),
|
||||
divFactor,
|
||||
*dynamic_cast<const BOARD_ITEM*>( m_settings.GetBoard() ),
|
||||
iOutlinePolyIdx );
|
||||
}
|
||||
|
||||
if( m_settings.GetFlag( FL_SHOW_BOARD_BODY ) )
|
||||
{
|
||||
|
||||
@@ -408,17 +408,16 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
|
||||
CGENERICCONTAINER2D &aDstContainer,
|
||||
float aBiuTo3DunitsScale,
|
||||
float aDivFactor,
|
||||
const BOARD_ITEM &aBoardItem )
|
||||
const BOARD_ITEM &aBoardItem,
|
||||
int aPolyIndex )
|
||||
{
|
||||
BOX2I pathBounds = aMainPath.BBox();
|
||||
|
||||
// Get the path
|
||||
|
||||
wxASSERT( aMainPath.OutlineCount() == 1 );
|
||||
const SHAPE_POLY_SET::POLYGON& curr_polywithholes = aMainPath.CPolygon( 0 );
|
||||
wxASSERT( aPolyIndex < aMainPath.OutlineCount() );
|
||||
|
||||
wxASSERT( curr_polywithholes.size() == 1 );
|
||||
const SHAPE_LINE_CHAIN& path = curr_polywithholes[0]; // a simple polygon
|
||||
const SHAPE_LINE_CHAIN& path = aMainPath.COutline( aPolyIndex );
|
||||
|
||||
BOX2I pathBounds = path.BBox();
|
||||
|
||||
// Convert the points to segments class
|
||||
CBBOX2D bbox;
|
||||
@@ -430,8 +429,10 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
|
||||
// Contains a closed polygon used to calc if points are inside
|
||||
SEGMENTS segments;
|
||||
|
||||
segments_and_normals.resize( path.PointCount() );
|
||||
segments.resize( path.PointCount() );
|
||||
segments_and_normals.reserve( path.PointCount() );
|
||||
segments.reserve( path.PointCount() );
|
||||
|
||||
SFVEC2F prevPoint;
|
||||
|
||||
for( int i = 0; i < path.PointCount(); i++ )
|
||||
{
|
||||
@@ -440,9 +441,23 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
|
||||
const SFVEC2F point ( (float)( a.x) * aBiuTo3DunitsScale,
|
||||
(float)(-a.y) * aBiuTo3DunitsScale );
|
||||
|
||||
bbox.Union( point );
|
||||
segments_and_normals[i].m_Start = point;
|
||||
segments[i].m_Start = point;
|
||||
// Only add points that are not coincident
|
||||
if( (i == 0) ||
|
||||
(fabs(prevPoint.x - point.x) > FLT_EPSILON) ||
|
||||
(fabs(prevPoint.y - point.y) > FLT_EPSILON) )
|
||||
{
|
||||
prevPoint = point;
|
||||
|
||||
bbox.Union( point );
|
||||
|
||||
SEGMENT_WITH_NORMALS sn;
|
||||
sn.m_Start = point;
|
||||
segments_and_normals.push_back( sn );
|
||||
|
||||
POLYSEGMENT ps;
|
||||
ps.m_Start = point;
|
||||
segments.push_back( ps );
|
||||
}
|
||||
}
|
||||
|
||||
bbox.ScaleNextUp();
|
||||
@@ -518,13 +533,13 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
|
||||
segments_and_normals[i].m_Normals.m_Start = normalSeg;
|
||||
else
|
||||
segments_and_normals[i].m_Normals.m_Start =
|
||||
glm::normalize( (((normalBeforeSeg * dotBefore ) + normalSeg) * 0.5f) );
|
||||
glm::normalize( (normalBeforeSeg * dotBefore ) + normalSeg );
|
||||
|
||||
if( dotAfter < 0.7f )
|
||||
segments_and_normals[i].m_Normals.m_End = normalSeg;
|
||||
else
|
||||
segments_and_normals[i].m_Normals.m_End =
|
||||
glm::normalize( (((normalAfterSeg * dotAfter ) + normalSeg) * 0.5f) );
|
||||
glm::normalize( (normalAfterSeg * dotAfter ) + normalSeg );
|
||||
}
|
||||
|
||||
if( aDivFactor == 0.0f )
|
||||
@@ -711,35 +726,6 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
|
||||
}
|
||||
|
||||
|
||||
void Polygon_Calc_BBox_3DU( const SHAPE_POLY_SET &aPolysList,
|
||||
CBBOX2D &aOutBBox ,
|
||||
float aBiuTo3DunitsScale )
|
||||
{
|
||||
aOutBBox.Reset();
|
||||
|
||||
for( int idx = 0; idx < aPolysList.OutlineCount(); ++idx )
|
||||
{
|
||||
// Each polygon in aPolysList is a polygon with holes
|
||||
const SHAPE_POLY_SET::POLYGON& curr_polywithholes = aPolysList.CPolygon( idx );
|
||||
|
||||
for( unsigned ipoly = 0; ipoly < curr_polywithholes.size(); ++ipoly )
|
||||
{
|
||||
const SHAPE_LINE_CHAIN& path = curr_polywithholes[ipoly]; // a simple polygon
|
||||
|
||||
for( int jj = 0; jj < path.PointCount(); jj++ )
|
||||
{
|
||||
const VECTOR2I& a = path.CPoint( jj );
|
||||
|
||||
aOutBBox.Union( SFVEC2F( (float) a.x * aBiuTo3DunitsScale,
|
||||
(float)-a.y * aBiuTo3DunitsScale ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aOutBBox.ScaleNextUp();
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
static void polygon_Convert( const ClipperLib::Path &aPath,
|
||||
SEGMENTS &aOutSegment,
|
||||
|
||||
@@ -148,11 +148,8 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
|
||||
CGENERICCONTAINER2D &aDstContainer,
|
||||
float aBiuTo3DunitsScale,
|
||||
float aDivFactor,
|
||||
const BOARD_ITEM &aBoardItem );
|
||||
|
||||
void Polygon_Calc_BBox_3DU( const SHAPE_POLY_SET &aPolysList,
|
||||
CBBOX2D &aOutBBox,
|
||||
float aBiuTo3DunitsScale );
|
||||
const BOARD_ITEM &aBoardItem,
|
||||
int aPolyIndex );
|
||||
|
||||
void Polygon2d_TestModule();
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
bool IsPointInside( const SFVEC2F &aPoint ) const override;
|
||||
};
|
||||
|
||||
static const float s_min_dot = (FLT_EPSILON * 4.0f) ;
|
||||
static const float s_min_dot = (FLT_EPSILON * 4.0f * FLT_EPSILON * 4.0f) ;
|
||||
|
||||
/**
|
||||
* @brief Segment_is_a_circle - check if segment start and end is very close to each other
|
||||
|
||||
@@ -31,6 +31,17 @@
|
||||
#include <wx/log.h>
|
||||
|
||||
|
||||
// A helper function to normalize aAngle between -2PI and +2PI
|
||||
inline void normalise2PI( float& aAngle )
|
||||
{
|
||||
while( aAngle > 0.0 )
|
||||
aAngle -= M_PI*2;
|
||||
|
||||
while( aAngle < 0.0 )
|
||||
aAngle += M_PI*2;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trace mask used to enable or disable the trace output of this class.
|
||||
* The debug output can be turned on by setting the WXTRACE environment variable to
|
||||
@@ -95,6 +106,20 @@ void CCAMERA::Reset_T1()
|
||||
m_zoom_t1 = 1.0f;
|
||||
m_rotate_aux_t1 = SFVEC3F( 0.0f );
|
||||
m_lookat_pos_t1 = m_board_lookat_pos_init;
|
||||
|
||||
|
||||
// Since 0 = 2pi, we want to reset the angle to be the closest
|
||||
// one to where we currently are. That ensures that we rotate
|
||||
// the board around the smallest distance getting there.
|
||||
if( m_rotate_aux_t0.x > M_PI )
|
||||
m_rotate_aux_t1.x = 2*M_PI;
|
||||
|
||||
if( m_rotate_aux_t0.y > M_PI )
|
||||
m_rotate_aux_t1.y = 2*M_PI;
|
||||
|
||||
if( m_rotate_aux_t0.z > M_PI )
|
||||
m_rotate_aux_t1.z = 2*M_PI;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -111,14 +136,17 @@ void CCAMERA::updateRotationMatrix()
|
||||
m_rotationMatrixAux = glm::rotate( glm::mat4( 1.0f ),
|
||||
m_rotate_aux.x,
|
||||
SFVEC3F( 1.0f, 0.0f, 0.0f ) );
|
||||
normalise2PI( m_rotate_aux.x );
|
||||
|
||||
m_rotationMatrixAux = glm::rotate( m_rotationMatrixAux,
|
||||
m_rotate_aux.y,
|
||||
SFVEC3F( 0.0f, 1.0f, 0.0f ) );
|
||||
normalise2PI( m_rotate_aux.y );
|
||||
|
||||
m_rotationMatrixAux = glm::rotate( m_rotationMatrixAux,
|
||||
m_rotate_aux.z,
|
||||
SFVEC3F( 0.0f, 0.0f, 1.0f ) );
|
||||
normalise2PI( m_rotate_aux.z );
|
||||
|
||||
m_parametersChanged = true;
|
||||
|
||||
@@ -163,7 +191,7 @@ void CCAMERA::rebuildProjection()
|
||||
|
||||
m_projectionMatrixInv = glm::inverse( m_projectionMatrix );
|
||||
|
||||
m_frustum.tang = glm::tan( glm::radians( m_frustum.angle ) * 0.5f ) ;
|
||||
m_frustum.tang = glm::tan( glm::radians( m_frustum.angle ) * 0.5f );
|
||||
|
||||
m_focalLen.x = ( (float)m_windowSize.y / (float)m_windowSize.x ) / m_frustum.tang;
|
||||
m_focalLen.y = 1.0f / m_frustum.tang;
|
||||
@@ -178,19 +206,21 @@ void CCAMERA::rebuildProjection()
|
||||
|
||||
m_frustum.nearD = -m_frustum.farD; // Use a symmetrical clip plane for ortho projection
|
||||
|
||||
const float orthoReductionFactor = m_zoom / 75.0f;
|
||||
// This formula was found by trial and error
|
||||
const float orthoReductionFactor = glm::length( m_camera_pos_init ) *
|
||||
m_zoom * m_zoom * 0.5f;
|
||||
|
||||
// Initialize Projection Matrix for Ortographic View
|
||||
m_projectionMatrix = glm::ortho( -m_windowSize.x * orthoReductionFactor,
|
||||
m_windowSize.x * orthoReductionFactor,
|
||||
-m_windowSize.y * orthoReductionFactor,
|
||||
m_windowSize.y * orthoReductionFactor,
|
||||
m_projectionMatrix = glm::ortho( -m_frustum.ratio * orthoReductionFactor,
|
||||
m_frustum.ratio * orthoReductionFactor,
|
||||
-orthoReductionFactor,
|
||||
orthoReductionFactor,
|
||||
m_frustum.nearD, m_frustum.farD );
|
||||
|
||||
m_projectionMatrixInv = glm::inverse( m_projectionMatrix );
|
||||
|
||||
m_frustum.nw = m_windowSize.x * orthoReductionFactor * 2.0f;
|
||||
m_frustum.nh = m_windowSize.y * orthoReductionFactor * 2.0f;
|
||||
m_frustum.nw = orthoReductionFactor * 2.0f * m_frustum.ratio;
|
||||
m_frustum.nh = orthoReductionFactor * 2.0f;
|
||||
m_frustum.fw = m_frustum.nw;
|
||||
m_frustum.fh = m_frustum.nh;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2020 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
|
||||
@@ -22,11 +22,12 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file eda_3d_viewer.cpp
|
||||
* @brief Implements a 3d viewer windows GUI
|
||||
*/
|
||||
|
||||
#include <wx/colordlg.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/wupdlock.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include "eda_3d_viewer.h"
|
||||
|
||||
#include "../3d_viewer_id.h"
|
||||
@@ -271,6 +272,7 @@ void EDA_3D_VIEWER::OnCloseWindow( wxCloseEvent &event )
|
||||
event.Skip( true );
|
||||
}
|
||||
|
||||
|
||||
#define ROT_ANGLE 10.0
|
||||
|
||||
void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
||||
@@ -292,7 +294,7 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
||||
break;
|
||||
|
||||
case ID_ROTATE3D_X_POS:
|
||||
m_settings.CameraGet().RotateX( glm::radians(ROT_ANGLE) );
|
||||
m_settings.CameraGet().RotateX( glm::radians( ROT_ANGLE ) );
|
||||
|
||||
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
|
||||
m_canvas->Request_refresh();
|
||||
@@ -302,7 +304,7 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
||||
break;
|
||||
|
||||
case ID_ROTATE3D_X_NEG:
|
||||
m_settings.CameraGet().RotateX( -glm::radians(ROT_ANGLE) );
|
||||
m_settings.CameraGet().RotateX( -glm::radians( ROT_ANGLE ) );
|
||||
|
||||
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
|
||||
m_canvas->Request_refresh();
|
||||
@@ -369,7 +371,11 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
||||
|
||||
case ID_ORTHO:
|
||||
m_settings.CameraGet().ToggleProjection();
|
||||
m_canvas->Request_refresh();
|
||||
|
||||
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
|
||||
m_canvas->Request_refresh();
|
||||
else
|
||||
m_canvas->RenderRaytracingRequest();
|
||||
return;
|
||||
|
||||
case ID_TOOL_SCREENCOPY_TOCLIBBOARD:
|
||||
@@ -761,7 +767,7 @@ void EDA_3D_VIEWER::LoadSettings( wxConfigBase *aCfg )
|
||||
aCfg->Read( keyRenderRAY_Shadows, &tmp, true );
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_SHADOWS, tmp );
|
||||
|
||||
aCfg->Read( keyRenderRAY_Backfloor, &tmp, true );
|
||||
aCfg->Read( keyRenderRAY_Backfloor, &tmp, false );
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_BACKFLOOR, tmp );
|
||||
|
||||
aCfg->Read( keyRenderRAY_Refractions, &tmp, true );
|
||||
@@ -985,6 +991,17 @@ void EDA_3D_VIEWER::takeScreenshot( wxCommandEvent& event )
|
||||
|
||||
fullFileName = m_defaultSaveScreenshotFileName.GetFullPath();
|
||||
|
||||
wxFileName fn = fullFileName;
|
||||
|
||||
if( !fn.IsDirWritable() )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
msg.Printf( _( "Insufficient permissions required to save file\n%s" ), fullFileName );
|
||||
wxMessageBox( msg, _( "Error" ), wxOK | wxICON_ERROR, this );
|
||||
return;
|
||||
}
|
||||
|
||||
// Be sure the screen area destroyed by the file dialog is redrawn
|
||||
// before making a screen copy.
|
||||
// Without this call, under Linux the screen refresh is made to late.
|
||||
|
||||
+4
-2
@@ -46,9 +46,10 @@ Russell Oliver <roliver8143[at]gmail-dot-com>
|
||||
Seth Hillbrand <hillbrand[at]ucdavis-dot-edu>
|
||||
Jeff Young <jeff[at]rokeby-dot-ie>
|
||||
Kevin Cozens <kevin[at]ve3syb-dot-ca>
|
||||
Ian McInerney <ian.s.mcinerney[at]ieee-dot-org>
|
||||
|
||||
See git repo on launchpad for contributors at
|
||||
https://code.launchpad.net/~kicad-product-committers/kicad/+git/product-git/+ref/master.
|
||||
See git repo on GitLab for contributors at
|
||||
https://gitlab.com/kicad/code/kicad/-/graphs/master
|
||||
|
||||
|
||||
== Document Writers
|
||||
@@ -75,6 +76,7 @@ Spanish (ES) Pedro Martin del Valle <pkicad[at]yahoo-dot-es>
|
||||
Spanish (ES) Iñigo Zuluaga <inigo_zuluaga[at]yahoo-dot-es>
|
||||
German (DE) Rafael Sokolowski <Rafael.Sokolowski[at]web-dot-de
|
||||
Japanese (JA) Kenta Yonekura <yoneken[at]kicad-dot-jp>
|
||||
Simplified Chinese (zh_CN) taotieren <admin[at]taotieren-dot-com>
|
||||
|
||||
Remy Halvick, David Briscoe, Dominique Laigle, Paul Burke
|
||||
|
||||
|
||||
+19
-3
@@ -413,7 +413,7 @@ endif()
|
||||
if( KICAD_USE_OCC )
|
||||
add_definitions( -DKICAD_USE_OCC )
|
||||
remove_definitions( -DKICAD_USE_OCE )
|
||||
unset( KICAD_USE_OCE )
|
||||
unset( KICAD_USE_OCE CACHE )
|
||||
endif()
|
||||
|
||||
if( KICAD_USE_CUSTOM_PADS )
|
||||
@@ -894,6 +894,16 @@ add_custom_target( uninstall
|
||||
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" )
|
||||
|
||||
|
||||
#################################################
|
||||
# Generate platform metadata files
|
||||
#################################################
|
||||
if( APPLE )
|
||||
include( ${CMAKE_MODULE_PATH}/WritePlatformMetadata_macos.cmake )
|
||||
elseif( UNIX )
|
||||
include( ${CMAKE_MODULE_PATH}/WritePlatformMetadata_linux.cmake )
|
||||
endif()
|
||||
|
||||
|
||||
#================================================
|
||||
# Installation
|
||||
#================================================
|
||||
@@ -919,7 +929,7 @@ if( UNIX AND NOT APPLE )
|
||||
set( UNIX_MIME_FILES ${UNIX_MIME_DIR}/mime )
|
||||
set( UNIX_ICON_FILES ${UNIX_MIME_DIR}/icons )
|
||||
set( UNIX_APPLICATIONS_FILES ${UNIX_MIME_DIR}/applications )
|
||||
set( UNIX_APPDATA_FILES resources/linux/appdata )
|
||||
set( UNIX_APPDATA_FILES ${PROJECT_BINARY_DIR}/resources/linux/appdata )
|
||||
|
||||
# Install Mime directory
|
||||
install( DIRECTORY ${UNIX_ICON_FILES}
|
||||
@@ -943,6 +953,9 @@ if( UNIX AND NOT APPLE )
|
||||
install( DIRECTORY ${UNIX_APPDATA_FILES}
|
||||
DESTINATION share
|
||||
COMPONENT resources
|
||||
FILES_MATCHING
|
||||
PATTERN "*appdata.xml"
|
||||
PATTERN "*.in" EXCLUDE
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -988,7 +1001,10 @@ add_subdirectory( plugins ) # 3D plugins must be built before kicad
|
||||
add_subdirectory( kicad ) # should follow pcbnew, eeschema
|
||||
add_subdirectory( tools )
|
||||
add_subdirectory( utils )
|
||||
add_subdirectory( qa )
|
||||
|
||||
if( KICAD_BUILD_QA_TESTS )
|
||||
add_subdirectory( qa )
|
||||
endif()
|
||||
|
||||
# Resources
|
||||
if ( KICAD_INSTALL_DEMOS )
|
||||
|
||||
@@ -27,6 +27,8 @@ macro( create_git_version_header _git_src_path )
|
||||
find_package( Git )
|
||||
|
||||
if( GIT_FOUND )
|
||||
message( STATUS "Using Git to determine build version string." )
|
||||
|
||||
set( _Git_SAVED_LC_ALL "$ENV{LC_ALL}" )
|
||||
set( ENV{LC_ALL} C )
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2019 Ian McInerney <Ian.S.McInerney@ieee.org>
|
||||
# Copyright (C) 2019 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
|
||||
#
|
||||
|
||||
# This file will create the full KiCad version string. The base of this string
|
||||
# will be either the git tag followed by the commit hash (if built inside a git
|
||||
# repository), or the version from KiCadVersion.cmake. The user-provided
|
||||
# KICAD_VERSION_EXTRA is then appended to the base version string.
|
||||
|
||||
# Use git to determine the version string if it's available.
|
||||
include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
|
||||
create_git_version_header( ${SRC_PATH} )
|
||||
|
||||
# $KICAD_VERSION is set in KiCadVersion.cmake or by git (if it is available).
|
||||
set( KICAD_VERSION_FULL "${KICAD_VERSION}" )
|
||||
|
||||
# Optional user version information defined at configuration.
|
||||
if( KICAD_VERSION_EXTRA )
|
||||
set( KICAD_VERSION_FULL "${KICAD_VERSION_FULL}-${KICAD_VERSION_EXTRA}" )
|
||||
endif()
|
||||
@@ -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.1.3" )
|
||||
set( KICAD_VERSION "5.1.6" )
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2019 Ian McInerney <Ian.S.McInerney@ieee.org>
|
||||
# Copyright (C) 2019 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
|
||||
#
|
||||
|
||||
# This file will configure the linux appdata.xml file to include the version
|
||||
# and build date.
|
||||
|
||||
message( STATUS "Creating linux metadata" )
|
||||
|
||||
# Create the KiCad version strings
|
||||
set( SRC_PATH ${PROJECT_SOURCE_DIR} )
|
||||
include( ${CMAKE_MODULE_PATH}/KiCadVersion.cmake )
|
||||
include( ${CMAKE_MODULE_PATH}/KiCadFullVersion.cmake )
|
||||
|
||||
# Create the date of the configure
|
||||
string( TIMESTAMP KICAD_CONFIG_TIMESTAMP "%Y-%m-%d" )
|
||||
|
||||
# Configure the KiCad appdata file
|
||||
configure_file( ${PROJECT_SOURCE_DIR}/resources/linux/appdata/kicad.appdata.xml.in
|
||||
${PROJECT_BINARY_DIR}/resources/linux/appdata/kicad.appdata.xml
|
||||
@ONLY )
|
||||
|
||||
# Ensure the file was configured successfully
|
||||
if( NOT EXISTS ${PROJECT_BINARY_DIR}/resources/linux/appdata/kicad.appdata.xml )
|
||||
message( FATAL_ERROR "Configuration failed to write file kicad.appdata.xml." )
|
||||
endif()
|
||||
@@ -0,0 +1,63 @@
|
||||
#
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2019 Ian McInerney <Ian.S.McInerney@ieee.org>
|
||||
# Copyright (C) 2019 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
|
||||
#
|
||||
|
||||
# This file will configure the MacOS info.plist files to include the version
|
||||
# and build date.
|
||||
|
||||
message( STATUS "Creating MacOS metadata" )
|
||||
|
||||
# Create the KiCad version strings
|
||||
set( SRC_PATH ${PROJECT_SOURCE_DIR} )
|
||||
include( ${CMAKE_MODULE_PATH}/KiCadVersion.cmake )
|
||||
include( ${CMAKE_MODULE_PATH}/KiCadFullVersion.cmake )
|
||||
|
||||
|
||||
# Configure each plist file from the respurces directory and store it in the build directory
|
||||
configure_file( ${PROJECT_SOURCE_DIR}/resources/macos/plist/bitmap2component.Info.plist.in
|
||||
${PROJECT_BINARY_DIR}/bitmap2component/Info.plist
|
||||
@ONLY )
|
||||
|
||||
configure_file( ${PROJECT_SOURCE_DIR}/resources/macos/plist/eeschema.Info.plist.in
|
||||
${PROJECT_BINARY_DIR}/eeschema/Info.plist
|
||||
@ONLY )
|
||||
|
||||
configure_file( ${PROJECT_SOURCE_DIR}/resources/macos/plist/gerbview.Info.plist.in
|
||||
${PROJECT_BINARY_DIR}/gerbview/Info.plist
|
||||
@ONLY )
|
||||
|
||||
configure_file( ${PROJECT_SOURCE_DIR}/resources/macos/plist/kicad.Info.plist.in
|
||||
${PROJECT_BINARY_DIR}/kicad/Info.plist
|
||||
@ONLY )
|
||||
|
||||
configure_file( ${PROJECT_SOURCE_DIR}/resources/macos/plist/pcb_calculator.Info.plist.in
|
||||
${PROJECT_BINARY_DIR}/pcb_calculator/Info.plist
|
||||
@ONLY )
|
||||
|
||||
configure_file( ${PROJECT_SOURCE_DIR}/resources/macos/plist/pcbnew.Info.plist.in
|
||||
${PROJECT_BINARY_DIR}/pcbnew/Info.plist
|
||||
@ONLY )
|
||||
|
||||
configure_file( ${PROJECT_SOURCE_DIR}/resources/macos/plist/pleditor.Info.plist.in
|
||||
${PROJECT_BINARY_DIR}/pagelayout_editor/Info.plist
|
||||
@ONLY )
|
||||
@@ -22,25 +22,9 @@
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
#
|
||||
|
||||
# Automagically create version header file if the version string was
|
||||
# not defined during the build configuration. If CreateGitVersionHeader
|
||||
# cannot determine the current repo version, a version.h file is still
|
||||
# created with KICAD_VERSION set in KiCadVersion.cmake.
|
||||
# Create the KiCad version strings
|
||||
include( ${CMAKE_MODULE_PATH}/KiCadVersion.cmake )
|
||||
|
||||
# Always use git if it's available to determine the version string.
|
||||
message( STATUS "Using Git to determine build version string." )
|
||||
include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
|
||||
create_git_version_header( ${SRC_PATH} )
|
||||
|
||||
# $KICAD_VERSION will always be set to something. Even if it is the default
|
||||
# value set in KiCadVersion.cmake
|
||||
set( KICAD_VERSION_FULL "${KICAD_VERSION}" )
|
||||
|
||||
# Optional user version information defined at configuration.
|
||||
if( KICAD_VERSION_EXTRA )
|
||||
set( KICAD_VERSION_FULL "${KICAD_VERSION_FULL}-${KICAD_VERSION_EXTRA}" )
|
||||
endif()
|
||||
include( ${CMAKE_MODULE_PATH}/KiCadFullVersion.cmake )
|
||||
|
||||
set( _wvh_new_version_text
|
||||
"/* Do not modify this file, it was automatically generated by CMake. */
|
||||
|
||||
@@ -222,7 +222,7 @@ and can cause Pcbnew to crash if Python scripts create an invalid object state w
|
||||
|
||||
The KiCad version string is defined by the output of `git describe --dirty` when git is available
|
||||
or the version string defined in CMakeModules/KiCadVersion.cmake with the value of
|
||||
KICAD_VERSION_EXTRA appended to the former. If the KICAD_VERSION_EXTRA variable is not define,
|
||||
KICAD_VERSION_EXTRA appended to the former. If the KICAD_VERSION_EXTRA variable is not defined,
|
||||
it is not appended to the version string. If the KICAD_VERSION_EXTRA variable is defined it
|
||||
is appended along with a leading '-' to the full version string as follows:
|
||||
|
||||
|
||||
@@ -54,11 +54,8 @@ target_link_libraries( bitmap2component
|
||||
)
|
||||
|
||||
if( APPLE )
|
||||
include( ${CMAKE_MODULE_PATH}/KiCadVersion.cmake )
|
||||
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist @ONLY )
|
||||
|
||||
set_target_properties( bitmap2component PROPERTIES
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
|
||||
MACOSX_BUNDLE_INFO_PLIST ${PROJECT_BINARY_DIR}/bitmap2component/Info.plist
|
||||
)
|
||||
|
||||
# put individual bundle outside of main bundle as a first step
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>bitmap2component</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string></string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>bitmap2component.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.kicad-pcb.bitmap2component</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>@KICAD_VERSION_FULL@</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Bitmap 2 Component</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@KICAD_VERSION@</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@KICAD_VERSION_FULL@</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>LSRequiresCarbon</key>
|
||||
<true/>
|
||||
<key>NSRequiresAquaSystemAppearance</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string></string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>True</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -8,14 +8,20 @@
|
||||
static const unsigned char png[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
|
||||
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff,
|
||||
0x61, 0x00, 0x00, 0x00, 0x60, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0x63, 0x90, 0x92, 0x92, 0xfa,
|
||||
0x0f, 0xc2, 0x0c, 0xe4, 0x02, 0xaa, 0x19, 0x20, 0x2e, 0x2e, 0x2e, 0x46, 0x91, 0x01, 0xd2, 0xd2,
|
||||
0xd2, 0x97, 0xc9, 0x32, 0x04, 0x66, 0x00, 0x14, 0x5f, 0x97, 0x97, 0x97, 0x97, 0x24, 0xd7, 0x80,
|
||||
0x4b, 0x64, 0x19, 0x02, 0x33, 0x40, 0x42, 0x42, 0x42, 0x94, 0x2c, 0x43, 0x90, 0x63, 0x01, 0x14,
|
||||
0x06, 0xa0, 0xb0, 0x40, 0xf3, 0x16, 0x5e, 0x4c, 0x3d, 0x03, 0xd0, 0xbd, 0x20, 0x2a, 0x2a, 0x2a,
|
||||
0x41, 0x76, 0x20, 0x12, 0xad, 0x19, 0x5b, 0x34, 0x92, 0xa4, 0x99, 0xaa, 0x09, 0x89, 0xe2, 0xa4,
|
||||
0x3c, 0x60, 0xb9, 0x11, 0x00, 0xd8, 0xbd, 0x63, 0x3e, 0x86, 0xe5, 0x97, 0x0f, 0x00, 0x00, 0x00,
|
||||
0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
|
||||
0x61, 0x00, 0x00, 0x00, 0xb9, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0x63, 0x60, 0x40, 0x03, 0x52,
|
||||
0x52, 0x52, 0xff, 0x41, 0x98, 0x01, 0x0b, 0x10, 0x11, 0x11, 0xe1, 0x95, 0x94, 0x94, 0xdc, 0xca,
|
||||
0x80, 0x0f, 0xe0, 0x32, 0x40, 0x5a, 0x5a, 0x5a, 0x06, 0x28, 0x7e, 0x1e, 0x97, 0xe1, 0x70, 0x1b,
|
||||
0xb0, 0x19, 0x20, 0x23, 0x23, 0x63, 0x06, 0x14, 0x7b, 0x81, 0xcf, 0x75, 0x20, 0xc0, 0x08, 0xb4,
|
||||
0x65, 0x2d, 0xba, 0x22, 0xa0, 0x93, 0x83, 0x80, 0xfc, 0xaf, 0x30, 0x71, 0x9c, 0x06, 0x00, 0x35,
|
||||
0xd7, 0xa0, 0x2b, 0x02, 0xd2, 0x65, 0x40, 0xfc, 0x17, 0x2a, 0x36, 0x0b, 0xa7, 0x01, 0x40, 0x41,
|
||||
0x37, 0x20, 0xfe, 0x83, 0xa4, 0x18, 0x84, 0xa7, 0x42, 0xe9, 0x7f, 0x40, 0xdc, 0x80, 0x33, 0x7c,
|
||||
0x80, 0xfe, 0x53, 0x05, 0x0a, 0xbe, 0x07, 0x49, 0x00, 0x9d, 0x5b, 0x85, 0xec, 0x0a, 0x20, 0xfe,
|
||||
0x0e, 0xc4, 0x11, 0x78, 0x03, 0x18, 0x28, 0x70, 0x05, 0x24, 0x08, 0xf2, 0x3f, 0x28, 0x1c, 0xd0,
|
||||
0x0c, 0x20, 0x88, 0x29, 0x37, 0x40, 0x5c, 0x5c, 0x5c, 0x11, 0xc8, 0x78, 0x03, 0x35, 0xa4, 0x9a,
|
||||
0x50, 0x54, 0xe1, 0x4a, 0x3c, 0xae, 0xe8, 0x81, 0xc8, 0x40, 0x2a, 0x40, 0xb6, 0x9d, 0x2c, 0x03,
|
||||
0x70, 0x25, 0x24, 0x92, 0x00, 0xae, 0xa4, 0x4c, 0x6a, 0x78, 0xd0, 0xd7, 0x00, 0x00, 0xe0, 0x1c,
|
||||
0x80, 0xeb, 0x37, 0x41, 0x6c, 0xd9, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42,
|
||||
0x60, 0x82,
|
||||
};
|
||||
|
||||
const BITMAP_OPAQUE pinshape_clock_fall_xpm[1] = {{ png, sizeof( png ), "pinshape_clock_fall_xpm" }};
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
width="16"
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
inkscape:version="0.92.0 r15299"
|
||||
sodipodi:docname="pinshape_clock_active_low.svg">
|
||||
<metadata
|
||||
id="metadata22">
|
||||
@@ -21,8 +21,23 @@
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
<dc:title></dc:title>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/by/4.0/" />
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/by/4.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
@@ -36,15 +51,15 @@
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1366"
|
||||
inkscape:window-height="744"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1033"
|
||||
id="namedview18"
|
||||
showgrid="true"
|
||||
inkscape:zoom="24.969708"
|
||||
inkscape:cx="4.4578733"
|
||||
inkscape:cy="9.2981956"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-x="-4"
|
||||
inkscape:window-y="-4"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2">
|
||||
<inkscape:grid
|
||||
|
||||
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 3.2 KiB |
@@ -11,8 +11,8 @@
|
||||
width="16"
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="pinshape_clock_fall.svg">
|
||||
inkscape:version="0.92.0 r15299"
|
||||
sodipodi:docname="pinshape_clock_active_low.svg">
|
||||
<metadata
|
||||
id="metadata22">
|
||||
<rdf:RDF>
|
||||
@@ -21,8 +21,23 @@
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
<dc:title></dc:title>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/by/4.0/" />
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/by/4.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
@@ -36,15 +51,15 @@
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1366"
|
||||
inkscape:window-height="744"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1033"
|
||||
id="namedview18"
|
||||
showgrid="true"
|
||||
inkscape:zoom="24.969708"
|
||||
inkscape:cx="4.4578733"
|
||||
inkscape:cy="9.2981956"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-x="-4"
|
||||
inkscape:window-y="-4"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2">
|
||||
<inkscape:grid
|
||||
@@ -56,19 +71,25 @@
|
||||
snapvisiblegridlinesonly="true" />
|
||||
</sodipodi:namedview>
|
||||
<path
|
||||
d="M 1,0 1,16"
|
||||
d="M 5,0 5,16"
|
||||
id="path12"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:none;stroke:#1a1a1a;stroke-width:2;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
d="M 6,8 16,8"
|
||||
d="M 5,8 16,8"
|
||||
id="path14"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:none;stroke:#1a1a1a;stroke-width:2;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
d="M 1,13 6,8 1,3"
|
||||
sodipodi:nodetypes="ccc"
|
||||
style="fill:none;stroke:#1a1a1a;stroke-width:2;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4010"
|
||||
d="m 5,8 7,-6 0,6" />
|
||||
<path
|
||||
d="M 5,13 1,8 5,3"
|
||||
id="path4094"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:none;stroke:#1a1a1a;stroke-width:2;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 3.2 KiB |
@@ -11,8 +11,8 @@
|
||||
width="16"
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="pinshape_clock_normal.svg">
|
||||
inkscape:version="0.92.0 r15299"
|
||||
sodipodi:docname="pinshape_clock_invert.svg">
|
||||
<metadata
|
||||
id="metadata22">
|
||||
<rdf:RDF>
|
||||
@@ -22,7 +22,22 @@
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/by/4.0/" />
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/by/4.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
@@ -36,15 +51,15 @@
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1366"
|
||||
inkscape:window-height="744"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1033"
|
||||
id="namedview18"
|
||||
showgrid="true"
|
||||
inkscape:zoom="24.969708"
|
||||
inkscape:cx="18.434809"
|
||||
inkscape:cy="9.4183412"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-x="-4"
|
||||
inkscape:window-y="-4"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2">
|
||||
<inkscape:grid
|
||||
|
||||
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 3.3 KiB |
+13
-6
@@ -153,10 +153,10 @@ install( TARGETS lib_kicad
|
||||
endif()
|
||||
|
||||
|
||||
# KiCad build version string defaults to "no-vcs-found" which forces the build version header
|
||||
# command to look for git to create the version string header when the .git path is found in
|
||||
# the source path.
|
||||
set( KICAD_BRANCH_NAME "" CACHE STRING "KiCad repository name." )
|
||||
# The build version string defaults to the value in the KiCadVersion.cmake file.
|
||||
# If being built inside a git repository, the git tag and commit hash are used to create
|
||||
# a new version string instead. The user can supply an additional string to be appended
|
||||
# to the end inside the KICAD_VERSION_EXTRA variable
|
||||
set( KICAD_VERSION_EXTRA "" CACHE STRING
|
||||
"User defined configuration string to append to KiCad version." )
|
||||
|
||||
@@ -164,8 +164,6 @@ set( KICAD_VERSION_EXTRA "" CACHE STRING
|
||||
add_custom_target(
|
||||
version_header ALL
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DKICAD_VERSION=${KICAD_VERSION}
|
||||
-DKICAD_BRANCH_NAME=${KICAD_BRANCH_NAME}
|
||||
-DKICAD_VERSION_EXTRA=${KICAD_VERSION_EXTRA}
|
||||
-DOUTPUT_FILE=${CMAKE_BINARY_DIR}/kicad_build_version.h
|
||||
-DSRC_PATH=${PROJECT_SOURCE_DIR}
|
||||
@@ -278,6 +276,7 @@ set( COMMON_SRCS
|
||||
${PLOTTERS_CONTROL_SRCS}
|
||||
advanced_config.cpp
|
||||
array_options.cpp
|
||||
base64.cpp
|
||||
base_struct.cpp
|
||||
bezier_curves.cpp
|
||||
bin_mod.cpp
|
||||
@@ -380,6 +379,14 @@ if( BUILD_GITHUB_PLUGIN )
|
||||
)
|
||||
endif()
|
||||
|
||||
# Link-time optimization (LTO) on GCC conflicts with embedded assembly (__asm),
|
||||
# following GCC's recommendation to disable LTO per translation unit.
|
||||
if( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set_source_files_properties( system/libcontext.cpp PROPERTIES
|
||||
COMPILE_FLAGS "-fno-lto"
|
||||
)
|
||||
endif()
|
||||
|
||||
set( COMMON_SRCS
|
||||
${COMMON_SRCS}
|
||||
system/libcontext.cpp
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* @author Seth Hillbrand <seth@kipro-pcb.com>
|
||||
*
|
||||
* 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 3
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <base64.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
#include <vector>
|
||||
|
||||
namespace {
|
||||
|
||||
static const uint8_t ENCODE_BASE64[64] = {
|
||||
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
|
||||
0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
|
||||
0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
|
||||
0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
|
||||
0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E,
|
||||
0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
|
||||
0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33,
|
||||
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F,
|
||||
};
|
||||
|
||||
static const uint8_t E = -1;
|
||||
|
||||
static const uint8_t DECODE_BASE64[128] = {
|
||||
/* 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xA 0xB 0xC 0xD 0xE 0xF */
|
||||
E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E,
|
||||
E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E,
|
||||
E, E, E, E, E, E, E, E, E, E, E, 62, E, E, E, 63,
|
||||
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, E, E, E, E, E, E,
|
||||
E, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, E, E, E, E, E,
|
||||
E, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, E, E, E, E, E,
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace base64
|
||||
{
|
||||
size_t encode_length( size_t aInputLen )
|
||||
{
|
||||
return 4 * ( ( aInputLen + 2 ) / 3 ) + ( aInputLen + 2 ) % 3 - 2;
|
||||
}
|
||||
|
||||
|
||||
size_t decode_length( size_t aInputLen )
|
||||
{
|
||||
if( aInputLen % 4 == 1 )
|
||||
return 0;
|
||||
else
|
||||
return 3 * ( ( aInputLen + 2 ) / 4 ) + ( aInputLen + 2 ) % 4 - 2;
|
||||
}
|
||||
|
||||
|
||||
void encode( const std::vector<uint8_t>& aInput, std::vector<uint8_t>& aOutput )
|
||||
{
|
||||
size_t end = ( aInput.size() / 3 ) * 3;
|
||||
aOutput.reserve( encode_length( aInput.size() ) );
|
||||
|
||||
for( size_t i = 0; i < end; i += 3 )
|
||||
{
|
||||
unsigned value = ( aInput[i] << 16 ) | ( aInput[i + 1] << 8 ) | aInput[i + 2] ;
|
||||
|
||||
aOutput.emplace_back( ENCODE_BASE64[( value >> 18 ) & 0x3F] );
|
||||
aOutput.emplace_back( ENCODE_BASE64[( value >> 12 ) & 0x3F] );
|
||||
aOutput.emplace_back( ENCODE_BASE64[( value >> 6 ) & 0x3F] );
|
||||
aOutput.emplace_back( ENCODE_BASE64[value & 0x3F] );
|
||||
}
|
||||
|
||||
size_t remainder = aInput.size() - end;
|
||||
|
||||
if( remainder )
|
||||
{
|
||||
unsigned value = aInput[end];
|
||||
|
||||
if( remainder == 2 )
|
||||
{
|
||||
value = ( value << 10 ) | ( aInput[end + 1] << 2 );
|
||||
aOutput.emplace_back( ENCODE_BASE64[( value >> 12 ) & 0x3F] );
|
||||
}
|
||||
else
|
||||
{
|
||||
value <<= 4;
|
||||
}
|
||||
|
||||
aOutput.emplace_back( ENCODE_BASE64[( value >> 6 ) & 0x3F] );
|
||||
aOutput.emplace_back( ENCODE_BASE64[value & 0x3F] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void decode(const std::vector<uint8_t>& aInput, std::vector<uint8_t>& aOutput )
|
||||
{
|
||||
size_t end = ( aInput.size() / 4 ) * 4;
|
||||
size_t decode_size = decode_length( aInput.size() );
|
||||
|
||||
if( !decode_size )
|
||||
return;
|
||||
|
||||
aOutput.reserve( decode_size );
|
||||
|
||||
for( size_t i = 0; i < end; i++ )
|
||||
{
|
||||
unsigned value = ( DECODE_BASE64[aInput[i] & 0x7F] << 18 ) |
|
||||
( DECODE_BASE64[aInput[i + 1] & 0x7F] << 12 ) |
|
||||
( DECODE_BASE64[aInput[i + 2] & 0x7F] << 6 ) |
|
||||
DECODE_BASE64[aInput[i + 3] & 0x7F];
|
||||
|
||||
aOutput.emplace_back( ( value >> 16 ) & 0xff );
|
||||
aOutput.emplace_back( ( value >> 8 ) & 0xff );
|
||||
aOutput.emplace_back( value & 0xff );
|
||||
}
|
||||
|
||||
size_t remainder = aInput.size() - end;
|
||||
|
||||
if( remainder )
|
||||
{
|
||||
unsigned value = ( ( DECODE_BASE64[aInput[end] & 0x7F] ) << 6 ) |
|
||||
( DECODE_BASE64[aInput[end + 1] & 0x7F] );
|
||||
|
||||
if( remainder == 3 )
|
||||
{
|
||||
value = ( value << 6 ) | ( DECODE_BASE64[aInput[end + 2] & 0x7F] );
|
||||
value >>= 2;
|
||||
|
||||
aOutput.emplace_back( ( value >> 8 ) & 0xff );
|
||||
}
|
||||
else
|
||||
{
|
||||
value >>= 4;
|
||||
}
|
||||
aOutput[0] = value & 0xff ;
|
||||
}
|
||||
}
|
||||
|
||||
} // base64
|
||||
@@ -405,6 +405,9 @@ bool EDA_RECT::Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2 ) cons
|
||||
|
||||
bool EDA_RECT::Intersects( const EDA_RECT& aRect ) const
|
||||
{
|
||||
if( !m_init )
|
||||
return false;
|
||||
|
||||
// this logic taken from wxWidgets' geometry.cpp file:
|
||||
bool rc;
|
||||
EDA_RECT me(*this);
|
||||
@@ -433,6 +436,9 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect ) const
|
||||
|
||||
bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
||||
{
|
||||
if( !m_init )
|
||||
return false;
|
||||
|
||||
/* Most rectangles will be axis aligned.
|
||||
* It is quicker to check for this case and pass the rect
|
||||
* to the simpler intersection test
|
||||
@@ -565,6 +571,9 @@ const wxPoint EDA_RECT::FarthestPointTo( const wxPoint& aPoint ) const
|
||||
|
||||
bool EDA_RECT::IntersectsCircle( const wxPoint& aCenter, const int aRadius ) const
|
||||
{
|
||||
if( !m_init )
|
||||
return false;
|
||||
|
||||
wxPoint closest = ClosestPointTo( aCenter );
|
||||
|
||||
double dx = aCenter.x - closest.x;
|
||||
@@ -578,6 +587,9 @@ bool EDA_RECT::IntersectsCircle( const wxPoint& aCenter, const int aRadius ) con
|
||||
|
||||
bool EDA_RECT::IntersectsCircleEdge( const wxPoint& aCenter, const int aRadius, const int aWidth ) const
|
||||
{
|
||||
if( !m_init )
|
||||
return false;
|
||||
|
||||
EDA_RECT me( *this );
|
||||
me.Normalize(); // ensure size is >= 0
|
||||
|
||||
@@ -675,6 +687,17 @@ EDA_RECT& EDA_RECT::Inflate( wxCoord dx, wxCoord dy )
|
||||
|
||||
void EDA_RECT::Merge( const EDA_RECT& aRect )
|
||||
{
|
||||
if( !m_init )
|
||||
{
|
||||
if( aRect.IsValid() )
|
||||
{
|
||||
m_Pos = aRect.GetPosition();
|
||||
m_Size = aRect.GetSize();
|
||||
m_init = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Normalize(); // ensure width and height >= 0
|
||||
EDA_RECT rect = aRect;
|
||||
rect.Normalize(); // ensure width and height >= 0
|
||||
@@ -692,6 +715,13 @@ void EDA_RECT::Merge( const EDA_RECT& aRect )
|
||||
|
||||
void EDA_RECT::Merge( const wxPoint& aPoint )
|
||||
{
|
||||
if( !m_init )
|
||||
{
|
||||
m_Pos = aPoint;
|
||||
m_Size = wxSize( 0, 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
Normalize(); // ensure width and height >= 0
|
||||
|
||||
wxPoint end = GetEnd();
|
||||
|
||||
+42
-336
@@ -1,8 +1,7 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2014-2017 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
* Copyright (C) 2014-2019 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
|
||||
@@ -26,362 +25,69 @@
|
||||
/* routines to handle bezier curves */
|
||||
/************************************/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <bezier_curves.h>
|
||||
|
||||
|
||||
static inline double calc_sq_distance( int x1, int y1, int x2, int y2 )
|
||||
BEZIER_POLY::BEZIER_POLY( const std::vector<wxPoint>& aControlPoints )
|
||||
{
|
||||
int dx = x2 - x1;
|
||||
int dy = y2 - y1;
|
||||
for( unsigned ii = 0; ii < aControlPoints.size(); ++ii )
|
||||
m_ctrlPts.emplace_back( VECTOR2D( aControlPoints[ii] ) );
|
||||
|
||||
return (double)dx * dx + (double)dy * dy;
|
||||
}
|
||||
|
||||
|
||||
static inline double sqrt_len( int dx, int dy )
|
||||
{
|
||||
return ((double)dx * dx) + ((double)dy * dy);
|
||||
m_minSegLen = 0.0;
|
||||
}
|
||||
|
||||
|
||||
void BEZIER_POLY::GetPoly( std::vector<wxPoint>& aOutput, int aMinSegLen )
|
||||
{
|
||||
wxCHECK( !m_ctrlPts.empty(), /* void */ );
|
||||
m_minSegLen = std::max( 1, aMinSegLen );
|
||||
m_output = &aOutput;
|
||||
m_output->clear();
|
||||
m_output->push_back( wxPoint( m_ctrlPts.front() ) );
|
||||
aOutput.clear();
|
||||
std::vector<VECTOR2D> buffer;
|
||||
GetPoly( buffer, double( aMinSegLen ) );
|
||||
|
||||
// Only quadratic and cubic Bezier curves are handled
|
||||
if( m_ctrlPts.size() == 3 )
|
||||
recursiveBezier( m_ctrlPts[0].x, m_ctrlPts[0].y,
|
||||
m_ctrlPts[1].x, m_ctrlPts[1].y,
|
||||
m_ctrlPts[2].x, m_ctrlPts[2].y, 0 );
|
||||
|
||||
else if( m_ctrlPts.size() == 4 )
|
||||
recursiveBezier( m_ctrlPts[0].x, m_ctrlPts[0].y,
|
||||
m_ctrlPts[1].x, m_ctrlPts[1].y,
|
||||
m_ctrlPts[2].x, m_ctrlPts[2].y,
|
||||
m_ctrlPts[3].x, m_ctrlPts[3].y, 0 );
|
||||
|
||||
m_output->push_back( wxPoint( m_ctrlPts.back() ) );
|
||||
for( unsigned ii = 0; ii < buffer.size(); ++ii )
|
||||
aOutput.emplace_back( wxPoint( int( buffer[ii].x ), int( buffer[ii].y ) ) );
|
||||
}
|
||||
|
||||
|
||||
void BEZIER_POLY::recursiveBezier( int x1, int y1, int x2, int y2,
|
||||
int x3, int y3, unsigned int level )
|
||||
void BEZIER_POLY::GetPoly( std::vector<VECTOR2D>& aOutput, double aMinSegLen )
|
||||
{
|
||||
if( level > recursion_limit )
|
||||
return;
|
||||
wxASSERT( m_ctrlPts.size() == 4 );
|
||||
// FIXME Brute force method, use a better (recursive?) algorithm
|
||||
// with a max error value.
|
||||
// to optimize the number of segments
|
||||
#define CURVE_POINTS 32
|
||||
double dt = 1.0 / CURVE_POINTS;
|
||||
|
||||
// Calculate all the mid-points of the line segments
|
||||
//----------------------
|
||||
int x12 = (x1 + x2) / 2;
|
||||
int y12 = (y1 + y2) / 2;
|
||||
int x23 = (x2 + x3) / 2;
|
||||
int y23 = (y2 + y3) / 2;
|
||||
int x123 = (x12 + x23) / 2;
|
||||
int y123 = (y12 + y23) / 2;
|
||||
aOutput.clear();
|
||||
aOutput.push_back( m_ctrlPts[0] );
|
||||
|
||||
int dx = x3 - x1;
|
||||
int dy = y3 - y1;
|
||||
double d = fabs( ((double) (x2 - x3) * dy) - ((double) (y2 - y3) * dx ) );
|
||||
double da;
|
||||
// If the Bezier curve is degenerated (straight line), skip intermediate points:
|
||||
bool degenerated = m_ctrlPts[0] == m_ctrlPts[1] && m_ctrlPts[2] == m_ctrlPts[3];
|
||||
|
||||
if( d > curve_collinearity_epsilon )
|
||||
if( !degenerated )
|
||||
{
|
||||
// Regular case
|
||||
//-----------------
|
||||
if( d * d <= distance_tolerance_square * (dx * dx + dy * dy) )
|
||||
for( int ii = 1; ii < CURVE_POINTS; ii++ )
|
||||
{
|
||||
// If the curvature doesn't exceed the distance_tolerance value
|
||||
// we tend to finish subdivisions.
|
||||
//----------------------
|
||||
if( angle_tolerance < curve_angle_tolerance_epsilon )
|
||||
{
|
||||
addSegment( wxPoint( x123, y123 ) );
|
||||
return;
|
||||
}
|
||||
double t = dt * ii;
|
||||
double omt = 1.0 - t;
|
||||
double omt2 = omt * omt;
|
||||
double omt3 = omt * omt2;
|
||||
double t2 = t * t;
|
||||
double t3 = t * t2;
|
||||
|
||||
// Angle & Cusp Condition
|
||||
//----------------------
|
||||
da = fabs( atan2( (double) ( y3 - y2 ), (double) ( x3 - x2 ) ) -
|
||||
atan2( (double) ( y2 - y1 ), (double) ( x2 - x1 ) ) );
|
||||
if( da >=M_PI )
|
||||
da = 2 * M_PI - da;
|
||||
VECTOR2D vertex = omt3 * m_ctrlPts[0]
|
||||
+ 3.0 * t * omt2 * m_ctrlPts[1]
|
||||
+ 3.0 * t2 * omt * m_ctrlPts[2]
|
||||
+ t3 * m_ctrlPts[3];
|
||||
|
||||
if( da < angle_tolerance )
|
||||
{
|
||||
// Finally we can stop the recursion
|
||||
//----------------------
|
||||
addSegment( wxPoint( x123, y123 ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Collinear case
|
||||
//------------------
|
||||
da = sqrt_len(dx, dy);
|
||||
if( da == 0 )
|
||||
{
|
||||
d = calc_sq_distance( x1, y1, x2, y2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
d = ( (double)(x2 - x1) * dx + (double)(y2 - y1) * dy ) / da;
|
||||
if( d > 0 && d < 1 )
|
||||
{
|
||||
// Simple collinear case, 1---2---3
|
||||
// We can leave just two endpoints
|
||||
return;
|
||||
}
|
||||
if( d <= 0 )
|
||||
d = calc_sq_distance( x2, y2, x1, y1 );
|
||||
else if( d >= 1 )
|
||||
d = calc_sq_distance( x2, y2, x3, y3 );
|
||||
else
|
||||
d = calc_sq_distance( x2, y2, x1 + (int) d * dx,
|
||||
y1 + (int) d * dy );
|
||||
}
|
||||
if( d < distance_tolerance_square )
|
||||
{
|
||||
addSegment( wxPoint( x2, y2 ) );
|
||||
return;
|
||||
// a minimal filter on the lenght of the segment being created:
|
||||
// The offset from last point:
|
||||
VECTOR2D delta = vertex - aOutput.back();
|
||||
double dist = delta.EuclideanNorm();
|
||||
|
||||
if( dist > aMinSegLen )
|
||||
aOutput.push_back( vertex );
|
||||
}
|
||||
}
|
||||
|
||||
// Continue subdivision
|
||||
//----------------------
|
||||
recursiveBezier( x1, y1, x12, y12, x123, y123, level + 1 );
|
||||
recursiveBezier( x123, y123, x23, y23, x3, y3, level + 1 );
|
||||
}
|
||||
|
||||
|
||||
void BEZIER_POLY::recursiveBezier( int x1, int y1, int x2, int y2,
|
||||
int x3, int y3, int x4, int y4, unsigned int level )
|
||||
{
|
||||
if( level > recursion_limit )
|
||||
return;
|
||||
|
||||
// Calculate all the mid-points of the line segments
|
||||
//----------------------
|
||||
int x12 = (x1 + x2) / 2;
|
||||
int y12 = (y1 + y2) / 2;
|
||||
int x23 = (x2 + x3) / 2;
|
||||
int y23 = (y2 + y3) / 2;
|
||||
int x34 = (x3 + x4) / 2;
|
||||
int y34 = (y3 + y4) / 2;
|
||||
int x123 = (x12 + x23) / 2;
|
||||
int y123 = (y12 + y23) / 2;
|
||||
int x234 = (x23 + x34) / 2;
|
||||
int y234 = (y23 + y34) / 2;
|
||||
int x1234 = (x123 + x234) / 2;
|
||||
int y1234 = (y123 + y234) / 2;
|
||||
|
||||
|
||||
// Try to approximate the full cubic curve by a single straight line
|
||||
//------------------
|
||||
int dx = x4 - x1;
|
||||
int dy = y4 - y1;
|
||||
|
||||
double d2 = fabs( (double) ( (x2 - x4) * dy - (y2 - y4) * dx ) );
|
||||
double d3 = fabs( (double) ( (x3 - x4) * dy - (y3 - y4) * dx ) );
|
||||
double da1, da2, k;
|
||||
|
||||
switch( (int(d2 > curve_collinearity_epsilon) << 1) +
|
||||
int(d3 > curve_collinearity_epsilon) )
|
||||
{
|
||||
case 0:
|
||||
|
||||
// All collinear OR p1==p4
|
||||
//----------------------
|
||||
k = dx * dx + dy * dy;
|
||||
if( k == 0 )
|
||||
{
|
||||
d2 = calc_sq_distance( x1, y1, x2, y2 );
|
||||
d3 = calc_sq_distance( x4, y4, x3, y3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
k = 1 / k;
|
||||
da1 = x2 - x1;
|
||||
da2 = y2 - y1;
|
||||
d2 = k * (da1 * dx + da2 * dy);
|
||||
da1 = x3 - x1;
|
||||
da2 = y3 - y1;
|
||||
d3 = k * (da1 * dx + da2 * dy);
|
||||
if( d2 > 0 && d2 < 1 && d3 > 0 && d3 < 1 )
|
||||
{
|
||||
// Simple collinear case, 1---2---3---4
|
||||
// We can leave just two endpoints
|
||||
return;
|
||||
}
|
||||
if( d2 <= 0 )
|
||||
d2 = calc_sq_distance( x2, y2, x1, y1 );
|
||||
else if( d2 >= 1 )
|
||||
d2 = calc_sq_distance( x2, y2, x4, y4 );
|
||||
else
|
||||
d2 = calc_sq_distance( x2, y2, x1 + (int) d2 * dx,
|
||||
y1 + (int) d2 * dy );
|
||||
|
||||
if( d3 <= 0 )
|
||||
d3 = calc_sq_distance( x3, y3, x1, y1 );
|
||||
else if( d3 >= 1 )
|
||||
d3 = calc_sq_distance( x3, y3, x4, y4 );
|
||||
else
|
||||
d3 = calc_sq_distance( x3, y3, x1 + (int) d3 * dx,
|
||||
y1 + (int) d3 * dy );
|
||||
}
|
||||
if( d2 > d3 )
|
||||
{
|
||||
if( d2 < distance_tolerance_square )
|
||||
{
|
||||
addSegment( wxPoint( x2, y2 ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( d3 < distance_tolerance_square )
|
||||
{
|
||||
addSegment( wxPoint( x3, y3 ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
||||
// p1,p2,p4 are collinear, p3 is significant
|
||||
//----------------------
|
||||
if( d3 * d3 <= distance_tolerance_square * sqrt_len(dx, dy) )
|
||||
{
|
||||
if( angle_tolerance < curve_angle_tolerance_epsilon )
|
||||
{
|
||||
addSegment( wxPoint( x23, y23 ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// Angle Condition
|
||||
//----------------------
|
||||
da1 = fabs( atan2( (double) ( y4 - y3 ), (double) ( x4 - x3 ) ) -
|
||||
atan2( (double) ( y3 - y2 ), (double) ( x3 - x2 ) ) );
|
||||
if( da1 >= M_PI )
|
||||
da1 = 2 * M_PI - da1;
|
||||
|
||||
if( da1 < angle_tolerance )
|
||||
{
|
||||
addSegment( wxPoint( x2, y2 ) );
|
||||
addSegment( wxPoint( x3, y3 ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( cusp_limit != 0.0 )
|
||||
{
|
||||
if( da1 > cusp_limit )
|
||||
{
|
||||
addSegment( wxPoint( x3, y3 ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
// p1,p3,p4 are collinear, p2 is significant
|
||||
//----------------------
|
||||
if( d2 * d2 <= distance_tolerance_square * sqrt_len(dx, dy) )
|
||||
{
|
||||
if( angle_tolerance < curve_angle_tolerance_epsilon )
|
||||
{
|
||||
addSegment( wxPoint( x23, y23 ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// Angle Condition
|
||||
//----------------------
|
||||
da1 = fabs( atan2( (double) ( y3 - y2 ), (double) ( x3 - x2 ) ) -
|
||||
atan2( (double) ( y2 - y1 ), (double) ( x2 - x1 ) ) );
|
||||
if( da1 >= M_PI )
|
||||
da1 = 2 * M_PI - da1;
|
||||
|
||||
if( da1 < angle_tolerance )
|
||||
{
|
||||
addSegment( wxPoint( x2, y2 ) );
|
||||
addSegment( wxPoint( x3, y3 ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( cusp_limit != 0.0 )
|
||||
{
|
||||
if( da1 > cusp_limit )
|
||||
{
|
||||
addSegment( wxPoint( x2, y2 ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
// Regular case
|
||||
//-----------------
|
||||
if( (d2 + d3) * (d2 + d3) <= distance_tolerance_square * sqrt_len(dx, dy) )
|
||||
{
|
||||
// If the curvature doesn't exceed the distance_tolerance value
|
||||
// we tend to finish subdivisions.
|
||||
//----------------------
|
||||
if( angle_tolerance < curve_angle_tolerance_epsilon )
|
||||
{
|
||||
addSegment( wxPoint( x23, y23 ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// Angle & Cusp Condition
|
||||
//----------------------
|
||||
k = atan2( (double) ( y3 - y2 ), (double) ( x3 - x2 ) );
|
||||
da1 = fabs( k - atan2( (double) ( y2 - y1 ),
|
||||
(double) ( x2 - x1 ) ) );
|
||||
da2 = fabs( atan2( (double) ( y4 - y3 ),
|
||||
(double) ( x4 - x3 ) ) - k );
|
||||
if( da1 >= M_PI )
|
||||
da1 = 2 * M_PI - da1;
|
||||
if( da2 >= M_PI )
|
||||
da2 = 2 * M_PI - da2;
|
||||
|
||||
if( da1 + da2 < angle_tolerance )
|
||||
{
|
||||
// Finally we can stop the recursion
|
||||
//----------------------
|
||||
addSegment( wxPoint( x23, y23 ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( cusp_limit != 0.0 )
|
||||
{
|
||||
if( da1 > cusp_limit )
|
||||
{
|
||||
addSegment( wxPoint( x2, y2 ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( da2 > cusp_limit )
|
||||
{
|
||||
addSegment( wxPoint( x3, y3 ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Continue subdivision
|
||||
//----------------------
|
||||
recursiveBezier( x1, y1, x12, y12, x123, y123, x1234, y1234, level + 1 );
|
||||
recursiveBezier( x1234, y1234, x234, y234, x34, y34, x4, y4, level + 1 );
|
||||
if( aOutput.back() != m_ctrlPts[3] )
|
||||
aOutput.push_back( m_ctrlPts[3] );
|
||||
}
|
||||
|
||||
@@ -240,18 +240,23 @@ void BITMAP_BASE::DrawBitmap( wxDC* aDC, const wxPoint& aPos )
|
||||
aDC->SetLogicalOrigin( logicalOriginX / GetScalingFactor(),
|
||||
logicalOriginY / GetScalingFactor() );
|
||||
|
||||
pos.x = KiROUND( pos.x / GetScalingFactor() );
|
||||
pos.y = KiROUND( pos.y / GetScalingFactor() );
|
||||
size.x = KiROUND( size.x / GetScalingFactor() );
|
||||
size.y = KiROUND( size.y / GetScalingFactor() );
|
||||
aDC->SetClippingRegion( pos, size );
|
||||
|
||||
if( GetGRForceBlackPenState() )
|
||||
{
|
||||
wxBitmap result( m_bitmap->ConvertToImage().ConvertToGreyscale() );
|
||||
aDC->DrawBitmap( result, KiROUND( pos.x / GetScalingFactor() ),
|
||||
KiROUND( pos.y / GetScalingFactor() ), true );
|
||||
aDC->DrawBitmap( result, pos.x, pos.y, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
aDC->DrawBitmap( *m_bitmap, KiROUND( pos.x / GetScalingFactor() ),
|
||||
KiROUND( pos.y / GetScalingFactor() ), true );
|
||||
aDC->DrawBitmap( *m_bitmap, pos.x, pos.y, true );
|
||||
}
|
||||
|
||||
aDC->DestroyClippingRegion();
|
||||
aDC->SetUserScale( scale, scale );
|
||||
aDC->SetLogicalOrigin( logicalOriginX, logicalOriginY );
|
||||
}
|
||||
|
||||
+32
-13
@@ -57,33 +57,46 @@ using KIGFX::COLOR4D;
|
||||
COLOR4D g_GhostColor;
|
||||
|
||||
|
||||
// When reading/writing files, we need to swtich to setlocale( LC_NUMERIC, "C" ).
|
||||
// Works fine to read/write files with floating point numbers.
|
||||
// We can call setlocale( LC_NUMERIC, "C" ) of wxLocale( "C", "C", "C", false )
|
||||
// wxWidgets discourage a direct call to setlocale
|
||||
// However, for us, calling wxLocale( "C", "C", "C", false ) has a unwanted effect:
|
||||
// The I18N translations are no longer active, because the English dixtionary is selected.
|
||||
// To read files, this is not a major issues, but the resul can differ
|
||||
// from using setlocale(xx, "C").
|
||||
// Previouly, we called setlocale( LC_NUMERIC, "C" )
|
||||
// The old code will be removed when calling wxLocale( "C", "C", "C", false )
|
||||
// is fully tested, and all issues fixed
|
||||
#define USE_WXLOCALE 1 /* 0 to call setlocale, 1 to call wxLocale */
|
||||
|
||||
// On Windows, when using setlocale, a wx alert is generated
|
||||
// in some cases (reading a bitmap for instance)
|
||||
// So we disable alerts during the time a file is read or written
|
||||
#if !USE_WXLOCALE
|
||||
#if defined( _WIN32 ) && defined( DEBUG )
|
||||
// a wxAssertHandler_t function to filter wxWidgets alert messages when reading/writing a file
|
||||
// when switching the locale to LC_NUMERIC, "C"
|
||||
// It is used in class LOCALE_IO to hide a useless (in kicad) wxWidgets alert message
|
||||
void KiAssertFilter( const wxString &file, int line,
|
||||
const wxString &func, const wxString &cond,
|
||||
const wxString &msg)
|
||||
const wxString &func, const wxString &cond,
|
||||
const wxString &msg)
|
||||
{
|
||||
if( !msg.Contains( "Decimal separator mismatch" ) )
|
||||
wxTheApp->OnAssertFailure( file, line, func, cond, msg );
|
||||
wxTheApp->OnAssertFailure( file.c_str(), line, func.c_str(), cond.c_str(), msg.c_str() );
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
std::atomic<unsigned int> LOCALE_IO::m_c_count( 0 );
|
||||
|
||||
|
||||
// Note on Windows, setlocale( LC_NUMERIC, "C" ) works fine to read/write
|
||||
// files with floating point numbers, but generates a overzealous wx alert
|
||||
// in some cases (reading a bitmap for instance)
|
||||
// So we disable alerts during the time a file is read or written
|
||||
|
||||
LOCALE_IO::LOCALE_IO()
|
||||
LOCALE_IO::LOCALE_IO() : m_wxLocale( nullptr )
|
||||
{
|
||||
// use thread safe, atomic operation
|
||||
if( m_c_count++ == 0 )
|
||||
{
|
||||
#if USE_WXLOCALE
|
||||
m_wxLocale = new wxLocale( "C", "C", "C", false );
|
||||
#else
|
||||
// Store the user locale name, to restore this locale later, in dtor
|
||||
m_user_locale = setlocale( LC_NUMERIC, nullptr );
|
||||
#if defined( _WIN32 ) && defined( DEBUG )
|
||||
@@ -92,6 +105,7 @@ LOCALE_IO::LOCALE_IO()
|
||||
#endif
|
||||
// Switch the locale to C locale, to read/write files with fp numbers
|
||||
setlocale( LC_NUMERIC, "C" );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,10 +116,15 @@ LOCALE_IO::~LOCALE_IO()
|
||||
if( --m_c_count == 0 )
|
||||
{
|
||||
// revert to the user locale
|
||||
#if USE_WXLOCALE
|
||||
delete m_wxLocale; // Deleting m_wxLocale restored previous locale
|
||||
m_wxLocale = nullptr;
|
||||
#else
|
||||
setlocale( LC_NUMERIC, m_user_locale.c_str() );
|
||||
#if defined( _WIN32 ) && defined( DEBUG )
|
||||
// Enable wxWidgets alerts
|
||||
wxSetDefaultAssertHandler();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -425,7 +444,7 @@ wxString KIwxExpandEnvVars(const wxString& str)
|
||||
if( !expanded )
|
||||
strResult << (wxChar)bracket;
|
||||
|
||||
str_m = str[++m];
|
||||
m++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -89,10 +89,10 @@ bool KIDIALOG::Show( bool aShow )
|
||||
return it->second;
|
||||
}
|
||||
|
||||
bool ret = wxRichMessageDialog::Show( aShow );
|
||||
int ret = wxRichMessageDialog::Show( aShow );
|
||||
|
||||
// Has the user asked not to show the dialog again
|
||||
if( IsCheckBoxChecked() )
|
||||
// Has the user asked not to show the dialog again and it was confirmed
|
||||
if( IsCheckBoxChecked() && ret != wxID_CANCEL )
|
||||
doNotShowAgainDlgs[m_hash] = ret;
|
||||
|
||||
return ret;
|
||||
@@ -110,7 +110,7 @@ int KIDIALOG::ShowModal()
|
||||
int ret = wxRichMessageDialog::ShowModal();
|
||||
|
||||
// Has the user asked not to show the dialog again
|
||||
if( IsCheckBoxChecked() )
|
||||
if( IsCheckBoxChecked() && ret != wxID_CANCEL )
|
||||
doNotShowAgainDlgs[m_hash] = ret;
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -64,7 +64,7 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.SetAppName( Pgm().App().GetAppName() );
|
||||
|
||||
/* Copyright information */
|
||||
aInfo.SetCopyright( "(C) 1992-2019 KiCad Developers Team" );
|
||||
aInfo.SetCopyright( "(C) 1992-2020 KiCad Developers Team" );
|
||||
|
||||
/* KiCad build version */
|
||||
wxString version;
|
||||
@@ -152,8 +152,7 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
description << "<ul>";
|
||||
description << "<li>"
|
||||
<< _( "Report or examine bugs - " )
|
||||
<< HtmlHyperlink( "https://bugs.launchpad.net/kicad/+bugs?orderby=-id&start=0",
|
||||
"https://bugs.launchpad.net/kicad" )
|
||||
<< HtmlHyperlink( "https://gitlab.com/kicad/code/kicad/issues" )
|
||||
<< "</li>";
|
||||
description << "</ul></p>";
|
||||
|
||||
@@ -167,11 +166,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
<< HtmlHyperlink( "https://forum.kicad.info" )
|
||||
<< "</li>";
|
||||
|
||||
description << "<li>"
|
||||
<<_( "KiCad user's group - " )
|
||||
<< HtmlHyperlink( "https://groups.yahoo.com/neo/groups/kicad-users/info" )
|
||||
<< "</li>";
|
||||
|
||||
description << "</ul></p>";
|
||||
|
||||
aInfo.SetDescription( description );
|
||||
|
||||
@@ -23,6 +23,18 @@
|
||||
|
||||
#define ALPHA_MAX 100 // the max value returned by the alpha (opacity) slider
|
||||
|
||||
|
||||
// Configure the spin controls contained inside the dialog
|
||||
void configureSpinCtrl( wxSpinCtrl* aCtrl )
|
||||
{
|
||||
wxSize textLength = aCtrl->GetTextExtent( "999" );
|
||||
wxSize ctrlSize = aCtrl->GetSizeFromTextSize( textLength );
|
||||
|
||||
aCtrl->SetMinSize( ctrlSize );
|
||||
aCtrl->SetSize( ctrlSize );
|
||||
}
|
||||
|
||||
|
||||
DIALOG_COLOR_PICKER::DIALOG_COLOR_PICKER( wxWindow* aParent, KIGFX::COLOR4D& aCurrentColor,
|
||||
bool aAllowOpacityControl, CUSTOM_COLORS_LIST* aUserColors )
|
||||
: DIALOG_COLOR_PICKER_BASE( aParent )
|
||||
@@ -131,6 +143,13 @@ bool DIALOG_COLOR_PICKER::TransferDataToWindow()
|
||||
SetEditVals( ALL_CHANGED );
|
||||
drawAll();
|
||||
|
||||
// Configure the spin control sizes
|
||||
configureSpinCtrl( m_spinCtrlGreen );
|
||||
configureSpinCtrl( m_spinCtrlBlue );
|
||||
configureSpinCtrl( m_spinCtrlRed );
|
||||
configureSpinCtrl( m_spinCtrlHue );
|
||||
configureSpinCtrl( m_spinCtrlSaturation );
|
||||
|
||||
m_notebook->GetPage( 0 )->Layout();
|
||||
m_notebook->GetPage( 1 )->Layout();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Mar 28 2019)
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -56,18 +56,12 @@ DIALOG_COLOR_PICKER_BASE::DIALOG_COLOR_PICKER_BASE( wxWindow* parent, wxWindowID
|
||||
fgSizerRGB->Add( m_staticTextB, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_spinCtrlRed = new wxSpinCtrl( sbSizerViewRGB->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 128 );
|
||||
m_spinCtrlRed->SetMinSize( wxSize( 80,-1 ) );
|
||||
|
||||
fgSizerRGB->Add( m_spinCtrlRed, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_spinCtrlGreen = new wxSpinCtrl( sbSizerViewRGB->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 128 );
|
||||
m_spinCtrlGreen->SetMinSize( wxSize( 80,-1 ) );
|
||||
|
||||
fgSizerRGB->Add( m_spinCtrlGreen, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_spinCtrlBlue = new wxSpinCtrl( sbSizerViewRGB->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 128 );
|
||||
m_spinCtrlBlue->SetMinSize( wxSize( 80,-1 ) );
|
||||
|
||||
fgSizerRGB->Add( m_spinCtrlBlue, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
@@ -103,13 +97,9 @@ DIALOG_COLOR_PICKER_BASE::DIALOG_COLOR_PICKER_BASE( wxWindow* parent, wxWindowID
|
||||
fgSizerHSV->Add( m_staticTextSat, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_spinCtrlHue = new wxSpinCtrl( sbSizerViewHSV->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
|
||||
m_spinCtrlHue->SetMinSize( wxSize( 80,-1 ) );
|
||||
|
||||
fgSizerHSV->Add( m_spinCtrlHue, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_spinCtrlSaturation = new wxSpinCtrl( sbSizerViewHSV->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 128 );
|
||||
m_spinCtrlSaturation->SetMinSize( wxSize( 80,-1 ) );
|
||||
|
||||
fgSizerHSV->Add( m_spinCtrlSaturation, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
<property name="file">dialog_color_picker_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">DIALOG_COLOR_PICKER_BASE</property>
|
||||
@@ -26,7 +25,6 @@
|
||||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
@@ -506,7 +504,7 @@
|
||||
<property name="min">0</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">80,-1</property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_spinCtrlRed</property>
|
||||
<property name="pane_border">1</property>
|
||||
@@ -569,7 +567,7 @@
|
||||
<property name="min">0</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">80,-1</property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_spinCtrlGreen</property>
|
||||
<property name="pane_border">1</property>
|
||||
@@ -632,7 +630,7 @@
|
||||
<property name="min">0</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">80,-1</property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_spinCtrlBlue</property>
|
||||
<property name="pane_border">1</property>
|
||||
@@ -918,7 +916,7 @@
|
||||
<property name="min">0</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">80,-1</property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_spinCtrlHue</property>
|
||||
<property name="pane_border">1</property>
|
||||
@@ -981,7 +979,7 @@
|
||||
<property name="min">0</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">80,-1</property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_spinCtrlSaturation</property>
|
||||
<property name="pane_border">1</property>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Mar 28 2019)
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 30 2017)
|
||||
// C++ code generated with wxFormBuilder (version Aug 15 2019)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -12,33 +12,36 @@
|
||||
DIALOG_DISPLAY_HTML_TEXT_BASE::DIALOG_DISPLAY_HTML_TEXT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
|
||||
|
||||
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
m_htmlWindow = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO );
|
||||
m_htmlWindow->SetMinSize( wxSize( 400,250 ) );
|
||||
|
||||
|
||||
bMainSizer->Add( m_htmlWindow, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_buttonClose = new wxButton( this, wxID_CANCEL, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_buttonClose->SetDefault();
|
||||
bMainSizer->Add( m_buttonClose, 0, wxALIGN_RIGHT|wxALL, 5 );
|
||||
|
||||
|
||||
|
||||
m_sdbSizer1 = new wxStdDialogButtonSizer();
|
||||
m_sdbSizer1OK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizer1->AddButton( m_sdbSizer1OK );
|
||||
m_sdbSizer1->Realize();
|
||||
|
||||
bMainSizer->Add( m_sdbSizer1, 0, wxBOTTOM|wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
bMainSizer->Fit( this );
|
||||
|
||||
|
||||
// Connect Events
|
||||
m_htmlWindow->Connect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnHTMLLinkClicked ), NULL, this );
|
||||
m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnCloseButtonClick ), NULL, this );
|
||||
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnOKButtonClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_DISPLAY_HTML_TEXT_BASE::~DIALOG_DISPLAY_HTML_TEXT_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_htmlWindow->Disconnect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnHTMLLinkClicked ), NULL, this );
|
||||
m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnCloseButtonClick ), NULL, this );
|
||||
|
||||
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnOKButtonClick ), NULL, this );
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="13" />
|
||||
<FileVersion major="1" minor="15" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
@@ -14,6 +14,8 @@
|
||||
<property name="file">dialog_display_info_HTML_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">dialog_display_info_HTML</property>
|
||||
<property name="namespace"></property>
|
||||
@@ -24,6 +26,7 @@
|
||||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
@@ -52,52 +55,16 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnActivate"></event>
|
||||
<event name="OnActivateApp"></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="OnChar"></event>
|
||||
<event name="OnClose"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnHibernate"></event>
|
||||
<event name="OnIconize"></event>
|
||||
<event name="OnIdle"></event>
|
||||
<event name="OnInitDialog"></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 class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="name">bMainSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxHtmlWindow" expanded="1">
|
||||
<object class="wxHtmlWindow" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
@@ -149,120 +116,26 @@
|
||||
<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="OnHtmlCellClicked"></event>
|
||||
<event name="OnHtmlCellHover"></event>
|
||||
<event name="OnHtmlLinkClicked">OnHTMLLinkClicked</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">5</property>
|
||||
<property name="flag">wxALIGN_RIGHT|wxALL</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" 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">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_CANCEL</property>
|
||||
<property name="label">OK</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>
|
||||
<object class="wxStdDialogButtonSizer" expanded="1">
|
||||
<property name="Apply">0</property>
|
||||
<property name="Cancel">0</property>
|
||||
<property name="ContextHelp">0</property>
|
||||
<property name="Help">0</property>
|
||||
<property name="No">0</property>
|
||||
<property name="OK">1</property>
|
||||
<property name="Save">0</property>
|
||||
<property name="Yes">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_buttonClose</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="name">m_sdbSizer1</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"></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="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnCloseButtonClick</event>
|
||||
<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>
|
||||
<event name="OnOKButtonClick">OnOKButtonClick</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 30 2017)
|
||||
// C++ code generated with wxFormBuilder (version Aug 15 2019)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DIALOG_DISPLAY_INFO_HTML_BASE_H__
|
||||
#define __DIALOG_DISPLAY_INFO_HTML_BASE_H__
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
@@ -18,8 +17,8 @@
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -31,21 +30,21 @@
|
||||
class DIALOG_DISPLAY_HTML_TEXT_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
protected:
|
||||
wxButton* m_buttonClose;
|
||||
|
||||
wxStdDialogButtonSizer* m_sdbSizer1;
|
||||
wxButton* m_sdbSizer1OK;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnHTMLLinkClicked( wxHtmlLinkEvent& event ) { event.Skip(); }
|
||||
virtual void OnCloseButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
wxHtmlWindow* m_htmlWindow;
|
||||
|
||||
DIALOG_DISPLAY_HTML_TEXT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
|
||||
DIALOG_DISPLAY_HTML_TEXT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_DISPLAY_HTML_TEXT_BASE();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif //__DIALOG_DISPLAY_INFO_HTML_BASE_H__
|
||||
|
||||
+5
-21
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -23,10 +23,6 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file displlst.cpp
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <macros.h>
|
||||
#include <draw_frame.h>
|
||||
@@ -46,11 +42,9 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
|
||||
const std::vector<wxArrayString>& aItemList,
|
||||
const wxString& aSelection,
|
||||
void( *aCallBackFunction )( wxString&, void* ),
|
||||
void* aCallBackFunctionData,
|
||||
bool aSortList, bool aShowHeaders ) :
|
||||
void* aCallBackFunctionData ) :
|
||||
EDA_LIST_DIALOG_BASE( aParent, wxID_ANY, aTitle )
|
||||
{
|
||||
m_sortList = aSortList;
|
||||
m_cb_func = aCallBackFunction;
|
||||
m_cb_data = aCallBackFunctionData;
|
||||
m_itemsListCp = &aItemList;
|
||||
@@ -59,9 +53,6 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
|
||||
|
||||
initDialog( aItemHeaders, aSelection );
|
||||
|
||||
if( !aShowHeaders )
|
||||
m_listBox->SetSingleStyle( wxLC_NO_HEADER, true );
|
||||
|
||||
// DIALOG_SHIM needs a unique hash_key because classname is not sufficient
|
||||
// because so many dialogs share this same class, with different numbers of
|
||||
// columns, different column names, and column widths.
|
||||
@@ -111,15 +102,10 @@ void EDA_LIST_DIALOG::initDialog( const wxArrayString& aItemHeaders, const wxStr
|
||||
}
|
||||
|
||||
|
||||
void EDA_LIST_DIALOG::SetFilterHint( const wxString& aHint )
|
||||
{
|
||||
m_filterBox->SetHint( aHint );
|
||||
}
|
||||
|
||||
|
||||
void EDA_LIST_DIALOG::SetListLabel( const wxString& aLabel )
|
||||
{
|
||||
m_listLabel->SetLabel( aLabel );
|
||||
m_listBox->SetSingleStyle( wxLC_NO_HEADER, true );
|
||||
}
|
||||
|
||||
|
||||
@@ -148,8 +134,7 @@ void EDA_LIST_DIALOG::textChangeInFilterBox( wxCommandEvent& event )
|
||||
}
|
||||
}
|
||||
|
||||
if( m_sortList )
|
||||
sortList();
|
||||
sortList();
|
||||
}
|
||||
|
||||
|
||||
@@ -219,8 +204,7 @@ void EDA_LIST_DIALOG::InsertItems( const std::vector< wxArrayString >& itemList,
|
||||
}
|
||||
}
|
||||
|
||||
if( m_sortList )
|
||||
sortList();
|
||||
sortList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -148,8 +148,6 @@ void EDA_DRAW_PANEL_GAL::SetFocus()
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
|
||||
{
|
||||
m_viewControls->UpdateScrollbars();
|
||||
|
||||
// Update current zoom settings if the canvas is managed by a EDA frame
|
||||
// (i.e. not by a preview panel in a dialog)
|
||||
if( GetParentEDAFrame() && GetParentEDAFrame()->GetScreen() )
|
||||
@@ -160,6 +158,8 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
|
||||
GetParentEDAFrame()->SetScrollCenterPosition( wxPoint( center.x, center.y ) );
|
||||
}
|
||||
|
||||
m_viewControls->UpdateScrollbars();
|
||||
|
||||
if( !m_gal->IsVisible() )
|
||||
return;
|
||||
|
||||
|
||||
+37
-10
@@ -68,6 +68,12 @@ static const wxString entrySizeX = "Size_x"; ///< Width of frame, in pixels (suf
|
||||
static const wxString entryMaximized = "Maximized"; ///< Nonzero iff frame is maximized (suffix)
|
||||
///@}
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( EDA_BASE_FRAME, wxFrame )
|
||||
EVT_MOVE( EDA_BASE_FRAME::OnMove )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aFrameName ) :
|
||||
@@ -279,18 +285,34 @@ void EDA_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||
aCfg->Read( text, &m_autoSaveInterval, DEFAULT_AUTO_SAVE_INTERVAL );
|
||||
}
|
||||
|
||||
// Ensure the window is on a connected display, and is visible.
|
||||
// (at least a corner of the frame must be visible on screen)
|
||||
// Sometimes, if a window was moved on an auxiliary display, and when this
|
||||
// display is no more available, it is not the case.
|
||||
wxRect rect( m_FramePos, m_FrameSize );
|
||||
// Ensure window isn't bigger than can be displayed
|
||||
int displayIndex = wxDisplay::GetFromPoint( m_FramePos );
|
||||
|
||||
if( wxDisplay::GetFromPoint( rect.GetTopLeft() ) == wxNOT_FOUND &&
|
||||
wxDisplay::GetFromPoint( rect.GetTopRight() ) == wxNOT_FOUND &&
|
||||
wxDisplay::GetFromPoint( rect.GetBottomLeft() ) == wxNOT_FOUND &&
|
||||
wxDisplay::GetFromPoint( rect.GetBottomRight() ) == wxNOT_FOUND )
|
||||
{
|
||||
if( displayIndex == wxNOT_FOUND )
|
||||
displayIndex = 0;
|
||||
|
||||
wxDisplay display( displayIndex );
|
||||
wxRect clientSize = display.GetClientArea();
|
||||
|
||||
// The window may have been saved on a display that is no longer present.
|
||||
// First, check the window origin and move it if it's off the chosen display
|
||||
|
||||
if( m_FramePos.x >= clientSize.x + clientSize.width ||
|
||||
m_FramePos.y >= clientSize.y + clientSize.height )
|
||||
m_FramePos = wxDefaultPosition;
|
||||
|
||||
// Now, fix up the size if needed
|
||||
|
||||
if( m_FrameSize.x + m_FramePos.x > clientSize.x + clientSize.width )
|
||||
{
|
||||
m_FrameSize.x = clientSize.width;
|
||||
m_FramePos.x = 0;
|
||||
}
|
||||
|
||||
if( m_FrameSize.y + m_FramePos.y > clientSize.y + clientSize.height )
|
||||
{
|
||||
m_FrameSize.y = clientSize.height;
|
||||
m_FramePos.y = 0;
|
||||
}
|
||||
|
||||
// Ensure Window title bar is visible
|
||||
@@ -302,7 +324,12 @@ void EDA_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||
int Ypos_min = 0;
|
||||
#endif
|
||||
if( m_FramePos.y < Ypos_min )
|
||||
{
|
||||
if( m_FrameSize.y + ( Ypos_min - m_FramePos.y ) > clientSize.height)
|
||||
m_FrameSize.y = clientSize.height - Ypos_min;
|
||||
|
||||
m_FramePos.y = Ypos_min;
|
||||
}
|
||||
|
||||
if( maximized )
|
||||
Maximize();
|
||||
|
||||
@@ -185,9 +185,9 @@ bool FILENAME_RESOLVER::createPathList()
|
||||
|
||||
if( GetKicadPaths( epaths ) )
|
||||
{
|
||||
for( const auto& i : epaths )
|
||||
for( const wxString& curr_path : epaths )
|
||||
{
|
||||
wxString pathVal = ExpandEnvVarSubstitutions( i );
|
||||
wxString pathVal = ExpandEnvVarSubstitutions( curr_path );
|
||||
|
||||
if( pathVal.empty() )
|
||||
{
|
||||
@@ -200,8 +200,8 @@ bool FILENAME_RESOLVER::createPathList()
|
||||
lpath.m_pathexp = fndummy.GetFullPath();
|
||||
}
|
||||
|
||||
lpath.m_alias = i;
|
||||
lpath.m_pathvar = i;
|
||||
lpath.m_alias = curr_path;
|
||||
lpath.m_pathvar = curr_path;
|
||||
|
||||
if( !lpath.m_pathexp.empty() && psep == *lpath.m_pathexp.rbegin() )
|
||||
lpath.m_pathexp.erase( --lpath.m_pathexp.end() );
|
||||
@@ -219,9 +219,8 @@ bool FILENAME_RESOLVER::createPathList()
|
||||
#ifdef DEBUG
|
||||
wxLogTrace( MASK_3D_RESOLVER, " * [3D model] search paths:\n" );
|
||||
std::list< SEARCH_PATH >::const_iterator sPL = m_Paths.begin();
|
||||
std::list< SEARCH_PATH >::const_iterator ePL = m_Paths.end();
|
||||
|
||||
while( sPL != ePL )
|
||||
while( sPL != m_Paths.end() )
|
||||
{
|
||||
wxLogTrace( MASK_3D_RESOLVER, " + %s : '%s'\n", (*sPL).m_alias.GetData(),
|
||||
(*sPL).m_pathexp.GetData() );
|
||||
@@ -636,9 +635,9 @@ bool FILENAME_RESOLVER::writePathList()
|
||||
|
||||
// skip all ${ENV_VAR} alias names
|
||||
std::list< SEARCH_PATH >::const_iterator sPL = m_Paths.begin();
|
||||
std::list< SEARCH_PATH >::const_iterator ePL = m_Paths.end();
|
||||
|
||||
while( sPL != ePL && ( sPL->m_alias.StartsWith( "${" ) || sPL->m_alias.StartsWith( "$(" ) ) )
|
||||
while( sPL != m_Paths.end() &&
|
||||
( sPL->m_alias.StartsWith( "${" ) || sPL->m_alias.StartsWith( "$(" ) ) )
|
||||
++sPL;
|
||||
|
||||
wxFileName cfgpath( m_ConfigDir, RESOLVER_CONFIG );
|
||||
@@ -662,7 +661,7 @@ bool FILENAME_RESOLVER::writePathList()
|
||||
cfgFile << "#V" << CFGFILE_VERSION << "\n";
|
||||
std::string tstr;
|
||||
|
||||
while( sPL != ePL )
|
||||
while( sPL != m_Paths.end() )
|
||||
{
|
||||
tstr = sPL->m_alias.ToUTF8();
|
||||
cfgFile << "\"" << tstr.size() << ":" << tstr << "\",";
|
||||
@@ -762,10 +761,9 @@ wxString FILENAME_RESOLVER::ShortenPath( const wxString& aFullPathName )
|
||||
|
||||
wxCriticalSectionLocker lock( lock_resolver );
|
||||
std::list< SEARCH_PATH >::const_iterator sL = m_Paths.begin();
|
||||
std::list< SEARCH_PATH >::const_iterator eL = m_Paths.end();
|
||||
size_t idx;
|
||||
|
||||
while( sL != eL )
|
||||
while( sL != m_Paths.end() )
|
||||
{
|
||||
// undefined paths do not participate in the
|
||||
// file name shortening procedure
|
||||
@@ -949,7 +947,7 @@ static bool getHollerith( const std::string& aString, size_t& aIndex, wxString&
|
||||
|
||||
if( nchars > 0 )
|
||||
{
|
||||
aResult = aString.substr( i2, nchars );
|
||||
aResult = wxString::FromUTF8( aString.substr( i2, nchars ).c_str() );
|
||||
i2 += nchars;
|
||||
}
|
||||
|
||||
|
||||
@@ -259,11 +259,12 @@ long long FP_LIB_TABLE::GenerateTimestamp( const wxString* aNickname )
|
||||
}
|
||||
|
||||
|
||||
void FP_LIB_TABLE::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aNickname )
|
||||
void FP_LIB_TABLE::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aNickname,
|
||||
bool aBestEfforts )
|
||||
{
|
||||
const FP_LIB_TABLE_ROW* row = FindRow( aNickname );
|
||||
wxASSERT( (PLUGIN*) row->plugin );
|
||||
row->plugin->FootprintEnumerate( aFootprintNames, row->GetFullURI( true ),
|
||||
row->plugin->FootprintEnumerate( aFootprintNames, row->GetFullURI( true ), aBestEfforts,
|
||||
row->GetProperties() );
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,9 @@ CAIRO_GAL_BASE::~CAIRO_GAL_BASE()
|
||||
|
||||
if( context )
|
||||
cairo_destroy( context );
|
||||
|
||||
for( auto imageSurface : imageSurfaces )
|
||||
cairo_surface_destroy( imageSurface );
|
||||
}
|
||||
|
||||
|
||||
@@ -424,8 +427,11 @@ void CAIRO_GAL_BASE::DrawPolygon( const SHAPE_LINE_CHAIN& aPolygon )
|
||||
|
||||
|
||||
void CAIRO_GAL_BASE::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aControlPointA,
|
||||
const VECTOR2D& aControlPointB, const VECTOR2D& aEndPoint )
|
||||
const VECTOR2D& aControlPointB, const VECTOR2D& aEndPoint,
|
||||
double aFilterValue )
|
||||
{
|
||||
// Note: aFilterValue is not used because the cubic Bezier curve is
|
||||
// supported by Cairo.
|
||||
syncLineWidth();
|
||||
|
||||
const auto sp = roundp( xform( aStartPoint ) );
|
||||
@@ -499,7 +505,9 @@ void CAIRO_GAL_BASE::DrawBitmap( const BITMAP_BASE& aBitmap )
|
||||
cairo_surface_mark_dirty( image );
|
||||
cairo_set_source_surface( currentContext, image, 0, 0 );
|
||||
cairo_paint( currentContext );
|
||||
cairo_surface_destroy( image );
|
||||
|
||||
// store the image handle so it can be destroyed later
|
||||
imageSurfaces.push_back( image );
|
||||
|
||||
isElementAdded = true;
|
||||
|
||||
@@ -920,6 +928,11 @@ void CAIRO_GAL_BASE::EnableDepthTest( bool aEnabled )
|
||||
|
||||
void CAIRO_GAL_BASE::resetContext()
|
||||
{
|
||||
for( auto imageSurface : imageSurfaces )
|
||||
cairo_surface_destroy( imageSurface );
|
||||
|
||||
imageSurfaces.clear();
|
||||
|
||||
ClearScreen();
|
||||
|
||||
// Compute the world <-> screen transformations
|
||||
@@ -1256,10 +1269,13 @@ void CAIRO_GAL::endDrawing()
|
||||
|
||||
// Now translate the raw context data from the format stored
|
||||
// by cairo into a format understood by wxImage.
|
||||
pixman_image_t* dstImg = pixman_image_create_bits( PIXMAN_r8g8b8,
|
||||
|
||||
pixman_image_t* dstImg = pixman_image_create_bits(
|
||||
wxPlatformInfo::Get().GetEndianness() == wxENDIAN_LITTLE ? PIXMAN_b8g8r8 :
|
||||
PIXMAN_r8g8b8,
|
||||
screenSize.x, screenSize.y, (uint32_t*) wxOutput, wxBufferWidth * 3 );
|
||||
pixman_image_t* srcImg = pixman_image_create_bits( PIXMAN_a8b8g8r8,
|
||||
screenSize.x, screenSize.y, (uint32_t*) bitmapBuffer, wxBufferWidth * 4 );
|
||||
pixman_image_t* srcImg = pixman_image_create_bits( PIXMAN_a8r8g8b8, screenSize.x, screenSize.y,
|
||||
(uint32_t*) bitmapBuffer, wxBufferWidth * 4 );
|
||||
|
||||
pixman_image_composite( PIXMAN_OP_SRC, srcImg, NULL, dstImg,
|
||||
0, 0, 0, 0, 0, 0, screenSize.x, screenSize.y );
|
||||
|
||||
@@ -63,11 +63,13 @@ CAIRO_PRINT_CTX::CAIRO_PRINT_CTX( wxDC* aDC )
|
||||
#ifdef __WXGTK__
|
||||
m_ctx = static_cast<cairo_t*>( gctx->GetNativeContext() );
|
||||
m_surface = cairo_get_target( m_ctx );
|
||||
// On linux, cairo printers are 72 DPI by default. This is an ususable resolution for us.
|
||||
// A reasonable resolution is 600 DPI
|
||||
// On linux, cairo printers have 72 DPI by default.
|
||||
// This is an unusable resolution for us.
|
||||
// A better resolution could be 4800 DPI (at 600 DPI, we still have minor
|
||||
// but visible artifacts, for instance with arcs, but not at 4800 DPI)
|
||||
// so modify the default:
|
||||
#define DEFAULT_DPI 72.0
|
||||
#define KICAD_PRINTER_DPI 600.0
|
||||
#define KICAD_PRINTER_DPI 4800.0
|
||||
// our device scale is DEFAULT_DPI / KICAD_PRINTER_DPI
|
||||
cairo_surface_set_device_scale( m_surface, DEFAULT_DPI/KICAD_PRINTER_DPI, DEFAULT_DPI/KICAD_PRINTER_DPI );
|
||||
m_dpi = KICAD_PRINTER_DPI;
|
||||
|
||||
@@ -64,6 +64,7 @@ static const wxChar* traceGalDispOpts = wxT( "KICAD_GAL_DISPLAY_OPTIONS" );
|
||||
GAL_DISPLAY_OPTIONS::GAL_DISPLAY_OPTIONS()
|
||||
: gl_antialiasing_mode( OPENGL_ANTIALIASING_MODE::NONE ),
|
||||
cairo_antialiasing_mode( CAIRO_ANTIALIASING_MODE::NONE ),
|
||||
m_dpi( nullptr, nullptr ),
|
||||
m_gridStyle( GRID_STYLE::DOTS ),
|
||||
m_gridLineWidth( 1.0 ),
|
||||
m_gridMinSpacing( 10.0 ),
|
||||
@@ -109,12 +110,10 @@ void GAL_DISPLAY_OPTIONS::ReadCommonConfig( wxConfigBase& aCommonConfig, wxWindo
|
||||
CAIRO_ANTIALIASING_MODE_KEY, &temp, (int) KIGFX::CAIRO_ANTIALIASING_MODE::NONE );
|
||||
cairo_antialiasing_mode = (KIGFX::CAIRO_ANTIALIASING_MODE) temp;
|
||||
|
||||
{
|
||||
const DPI_SCALING dpi{ &aCommonConfig, aWindow };
|
||||
m_scaleFactor = dpi.GetScaleFactor();
|
||||
}
|
||||
m_dpi = DPI_SCALING( &aCommonConfig, aWindow );
|
||||
|
||||
NotifyChanged();
|
||||
// Also calls NotifyChanged
|
||||
UpdateScaleFactor();
|
||||
}
|
||||
|
||||
|
||||
@@ -146,6 +145,13 @@ void GAL_DISPLAY_OPTIONS::WriteConfig( wxConfigBase& aCfg, const wxString& aBase
|
||||
}
|
||||
|
||||
|
||||
void GAL_DISPLAY_OPTIONS::UpdateScaleFactor()
|
||||
{
|
||||
m_scaleFactor = m_dpi.GetScaleFactor();
|
||||
NotifyChanged();
|
||||
}
|
||||
|
||||
|
||||
void GAL_DISPLAY_OPTIONS::NotifyChanged()
|
||||
{
|
||||
wxLogTrace( traceGalDispOpts, "Change notification" );
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <geometry/shape_poly_set.h>
|
||||
#include <text_utils.h>
|
||||
#include <bitmap_base.h>
|
||||
#include <bezier_curves.h>
|
||||
|
||||
#include <macros.h>
|
||||
|
||||
@@ -1034,34 +1035,21 @@ void OPENGL_GAL::DrawPolygon( const SHAPE_LINE_CHAIN& aPolygon )
|
||||
|
||||
|
||||
void OPENGL_GAL::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aControlPointA,
|
||||
const VECTOR2D& aControlPointB, const VECTOR2D& aEndPoint )
|
||||
const VECTOR2D& aControlPointB, const VECTOR2D& aEndPoint,
|
||||
double aFilterValue )
|
||||
{
|
||||
// FIXME The drawing quality needs to be improved
|
||||
// FIXME Perhaps choose a quad/triangle strip instead?
|
||||
// FIXME Brute force method, use a better (recursive?) algorithm
|
||||
std::vector<VECTOR2D> output;
|
||||
std::vector<VECTOR2D> pointCtrl;
|
||||
|
||||
std::deque<VECTOR2D> pointList;
|
||||
pointCtrl.push_back( aStartPoint );
|
||||
pointCtrl.push_back( aControlPointA );
|
||||
pointCtrl.push_back( aControlPointB );
|
||||
pointCtrl.push_back( aEndPoint );
|
||||
|
||||
double t = 0.0;
|
||||
double dt = 1.0 / (double) CURVE_POINTS;
|
||||
BEZIER_POLY converter( pointCtrl );
|
||||
converter.GetPoly( output, aFilterValue );
|
||||
|
||||
for( int i = 0; i <= CURVE_POINTS; i++ )
|
||||
{
|
||||
double omt = 1.0 - t;
|
||||
double omt2 = omt * omt;
|
||||
double omt3 = omt * omt2;
|
||||
double t2 = t * t;
|
||||
double t3 = t * t2;
|
||||
|
||||
VECTOR2D vertex = omt3 * aStartPoint + 3.0 * t * omt2 * aControlPointA
|
||||
+ 3.0 * t2 * omt * aControlPointB + t3 * aEndPoint;
|
||||
|
||||
pointList.push_back( vertex );
|
||||
|
||||
t += dt;
|
||||
}
|
||||
|
||||
DrawPolyline( pointList );
|
||||
DrawPolyline( &output[0], output.size() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe
|
||||
double glyphEndX = 0.0;
|
||||
VECTOR2D glyphBoundingX;
|
||||
|
||||
std::deque<VECTOR2D>* pointList = nullptr;
|
||||
std::vector<VECTOR2D>* pointList = nullptr;
|
||||
|
||||
int i = 0;
|
||||
|
||||
@@ -105,7 +105,7 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe
|
||||
|
||||
if( !pointList )
|
||||
{
|
||||
glyph.emplace_back( std::deque<VECTOR2D>() );
|
||||
glyph.emplace_back( std::vector<VECTOR2D>() );
|
||||
pointList = &glyph.back();
|
||||
}
|
||||
|
||||
@@ -140,17 +140,16 @@ BOX2D STROKE_FONT::computeBoundingBox( const GLYPH& aGLYPH, const VECTOR2D& aGLY
|
||||
{
|
||||
BOX2D boundingBox;
|
||||
|
||||
std::deque<VECTOR2D> boundingPoints;
|
||||
std::vector<VECTOR2D> boundingPoints;
|
||||
|
||||
boundingPoints.emplace_back( VECTOR2D( aGLYPHBoundingX.x, 0 ) );
|
||||
boundingPoints.emplace_back( VECTOR2D( aGLYPHBoundingX.y, 0 ) );
|
||||
|
||||
for( GLYPH::const_iterator pointListIt = aGLYPH.begin(); pointListIt != aGLYPH.end(); ++pointListIt )
|
||||
for( const auto& pointList : aGLYPH )
|
||||
{
|
||||
for( std::deque<VECTOR2D>::const_iterator pointIt = pointListIt->begin();
|
||||
pointIt != pointListIt->end(); ++pointIt )
|
||||
for( const auto& pt : pointList )
|
||||
{
|
||||
boundingPoints.emplace_back( VECTOR2D( aGLYPHBoundingX.x, pointIt->y ) );
|
||||
boundingPoints.emplace_back( aGLYPHBoundingX.x, pt.y );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,15 +340,13 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText )
|
||||
last_had_overbar = false;
|
||||
}
|
||||
|
||||
for( GLYPH::iterator pointListIt = glyph.begin(); pointListIt != glyph.end();
|
||||
++pointListIt )
|
||||
for( const auto& pointList : glyph )
|
||||
{
|
||||
std::deque<VECTOR2D> pointListScaled;
|
||||
|
||||
for( std::deque<VECTOR2D>::iterator pointIt = pointListIt->begin();
|
||||
pointIt != pointListIt->end(); ++pointIt )
|
||||
for( const auto& pt : pointList )
|
||||
{
|
||||
VECTOR2D pointPos( pointIt->x * glyphSize.x + xOffset, pointIt->y * glyphSize.y );
|
||||
VECTOR2D pointPos( pt.x * glyphSize.x + xOffset, pt.y * glyphSize.y );
|
||||
|
||||
if( m_gal->IsFontItalic() )
|
||||
{
|
||||
|
||||
+56
-13
@@ -170,8 +170,8 @@ std::string GBR_APERTURE_METADATA::FormatAttribute( GBR_APERTURE_ATTRIB aAttribu
|
||||
attribute_string = "TA.AperFunction,Conductor";
|
||||
break;
|
||||
|
||||
case GBR_APERTURE_ATTRIB_CUTOUT: // print info associated to a outline
|
||||
attribute_string = "TA.AperFunction,CutOut";
|
||||
case GBR_APERTURE_ATTRIB_EDGECUT: // print info associated to a board outline (edge.cut layer)
|
||||
attribute_string = "TA.AperFunction,Profile";
|
||||
break;
|
||||
|
||||
case GBR_APERTURE_ATTRIB_VIAPAD: // print info associated to a flashed via
|
||||
@@ -268,33 +268,78 @@ std::string GBR_APERTURE_METADATA::FormatAttribute( GBR_APERTURE_ATTRIB aAttribu
|
||||
return full_attribute_string;
|
||||
}
|
||||
|
||||
|
||||
// Helper function to convert a ascii hex char to its integer value
|
||||
// If the char is not a hexa char, return -1
|
||||
int char2Hex( unsigned aCode )
|
||||
{
|
||||
if( aCode >= '0' && aCode <= '9' )
|
||||
return aCode - '0';
|
||||
|
||||
if( aCode >= 'A' && aCode <= 'F' )
|
||||
return aCode - 'A' + 10;
|
||||
|
||||
if( aCode >= 'a' && aCode <= 'f' )
|
||||
return aCode - 'a' + 10;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
wxString FormatStringFromGerber( const wxString& aString )
|
||||
{
|
||||
// make the inverse conversion of formatStringToGerber()
|
||||
// It converts a "normalized" gerber string and convert it to a 16 bits sequence unicode
|
||||
// and return a wxString (unicode 16) from the gerber string
|
||||
// Note the initial gerber string can already contain unicode chars.
|
||||
wxString txt;
|
||||
|
||||
for( unsigned ii = 0; ii < aString.Length(); ++ii )
|
||||
unsigned count = aString.Length();
|
||||
|
||||
for( unsigned ii = 0; ii < count; ++ii )
|
||||
{
|
||||
unsigned code = aString[ii];
|
||||
|
||||
if( code == '\\' )
|
||||
if( code == '\\' && ii < count-5 && aString[ii+1] == 'u' )
|
||||
{
|
||||
// Convert 4 hexadecimal digits to a 16 bit unicode
|
||||
// Note the latest Gerber X2 spec (2019 06) uses \uXXXX to encode
|
||||
// the unicode XXXX hexadecimal value
|
||||
// If 4 chars next to 'u' are hexadecimal chars,
|
||||
// convert these 4 hexadecimal digits to a 16 bit unicode
|
||||
// (Gerber allows only 4 hexadecimal digits)
|
||||
// If an error occurs, the escape sequence is not translated,
|
||||
// and used "as this"
|
||||
long value = 0;
|
||||
bool error = false;
|
||||
|
||||
for( int jj = 0; jj < 4; jj++ )
|
||||
{
|
||||
value <<= 4;
|
||||
code = aString[++ii];
|
||||
// Very basic conversion, but it expects a valid gerber file
|
||||
int hexa = (code <= '9' ? code - '0' : code - 'A' + 10) & 0xF;
|
||||
value += hexa;
|
||||
code = aString[ii+jj+2];
|
||||
|
||||
int hexa = char2Hex( code );
|
||||
|
||||
if( hexa >= 0 )
|
||||
value += hexa;
|
||||
else
|
||||
{
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
txt.Append( wxChar( value ) );
|
||||
if( !error )
|
||||
{
|
||||
if( value >= ' ' ) // Is a valid wxChar ?
|
||||
txt.Append( wxChar( value ) );
|
||||
|
||||
ii += 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
txt.Append( aString[ii] );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
txt.Append( aString[ii] );
|
||||
@@ -334,12 +379,10 @@ std::string formatStringToGerber( const wxString& aString )
|
||||
|
||||
if( convert || code > 0x7F )
|
||||
{
|
||||
txt += '\\';
|
||||
|
||||
// Convert code to 4 hexadecimal digit
|
||||
// (Gerber allows only 4 hexadecimal digit)
|
||||
char hexa[32];
|
||||
sprintf( hexa,"%4.4X", code & 0xFFFF);
|
||||
sprintf( hexa,"\\u%4.4X", code & 0xFFFF);
|
||||
txt += hexa;
|
||||
}
|
||||
else
|
||||
|
||||
+11
-2
@@ -33,6 +33,7 @@ int sgn( T aVal )
|
||||
|
||||
bool SEG::PointCloserThan( const VECTOR2I& aP, int aDist ) const
|
||||
{
|
||||
// See http://geomalgorithms.com/a02-_lines.html for some explanations and ideas.
|
||||
VECTOR2I d = B - A;
|
||||
ecoord dist_sq = (ecoord) aDist * aDist;
|
||||
|
||||
@@ -44,9 +45,17 @@ bool SEG::PointCloserThan( const VECTOR2I& aP, int aDist ) const
|
||||
else if( t >= l_squared )
|
||||
return ( aP - B ).SquaredEuclideanNorm() < dist_sq;
|
||||
|
||||
int dxdy = abs( d.x ) - abs( d.y );
|
||||
// JPC: This code is not trivial and is not commented
|
||||
// and does not work for d.x or d.y = -1...1
|
||||
// I am guessing it is here for calculation time optimization.
|
||||
// if someone can understand it, please fix it.
|
||||
// It can be tested with a segment having d.x or d.y value
|
||||
// is -1 or +1 ("this" is a quasi vertical or horizontal segment)
|
||||
int dxdy = std::abs( d.x ) - std::abs( d.y );
|
||||
|
||||
if( ( dxdy >= -1 && dxdy <= 1 ) || abs( d.x ) <= 1 || abs( d.y ) <= 1 )
|
||||
if( ( dxdy >= -1 && dxdy <= 1 ) // quasi 45 deg segment
|
||||
/*|| std::abs( d.x ) <= 1 // quasi horizontal segment
|
||||
|| std::abs( d.y ) <= 1 // quasi vertical segment */ )
|
||||
{
|
||||
int ca = -sgn( d.y );
|
||||
int cb = sgn( d.x );
|
||||
|
||||
@@ -458,6 +458,8 @@ int SHAPE_POLY_SET::AddHole( const SHAPE_LINE_CHAIN& aHole, int aOutline )
|
||||
|
||||
POLYGON& poly = m_polys[aOutline];
|
||||
|
||||
assert( aOutline < (int)m_polys.size() );
|
||||
|
||||
assert( poly.size() );
|
||||
|
||||
poly.push_back( aHole );
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <trigo.h>
|
||||
#include <common.h>
|
||||
#include <math_for_graphics.h>
|
||||
#include <geometry/seg.h>
|
||||
|
||||
// Returns true if the point P is on the segment S.
|
||||
// faster than TestSegmentHit() because P should be exactly on S
|
||||
@@ -151,32 +152,8 @@ bool TestSegmentHit( const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int
|
||||
if( aStart.y == aEnd.y && aRefPoint.x > xmin && aRefPoint.x < xmax )
|
||||
return std::abs( delta.y ) <= aDist;
|
||||
|
||||
// Special case for a segment with start == end (equal to a circle)
|
||||
if ( aStart == aEnd )
|
||||
{
|
||||
long double length_square = (long double) delta.x * delta.x + (long double) delta.y * delta.y;
|
||||
long double dist_square = (long double) aDist * aDist;
|
||||
|
||||
return ( length_square <= dist_square );
|
||||
}
|
||||
|
||||
wxPoint len = aEnd - aStart;
|
||||
// Precision note here:
|
||||
// These are 32-bit integers, so squaring requires 64 bits to represent
|
||||
// exactly. 64-bit Doubles have only 52 bits in the mantissa, so we start to lose
|
||||
// precision at 2^53, which corresponds to ~ ±1nm @ 9.5cm, 2nm at 90cm, etc...
|
||||
// Long doubles avoid this ambiguity as well as the more expensive denormal double calc
|
||||
// Long doubles usually (sometimes more if SIMD) have at least 64 bits in the mantissa
|
||||
long double length_square = (long double) len.x * len.x + (long double) len.y * len.y;
|
||||
long double cross = std::abs( (long double) len.x * delta.y - (long double) len.y * delta.x );
|
||||
long double dist_square = (long double) aDist * aDist;
|
||||
|
||||
// The perpendicular distance to a line is the vector magnitude of the line from
|
||||
// a test point to the test line. That is the 2d determinant. Because we handled
|
||||
// the zero length case above, so we are guaranteed a unique solution.
|
||||
|
||||
return ( ( length_square >= cross && dist_square >= cross ) ||
|
||||
( length_square * dist_square >= cross * cross ) );
|
||||
SEG segment( aStart, aEnd );
|
||||
return segment.PointCloserThan( aRefPoint, aDist + 1 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
+10
-5
@@ -347,27 +347,32 @@ bool OpenPDF( const wxString& file )
|
||||
wxString command;
|
||||
wxString filename = file;
|
||||
|
||||
// Quote in case there are spaces in the file name.
|
||||
AddDelimiterString( filename );
|
||||
|
||||
Pgm().ReadPdfBrowserInfos();
|
||||
|
||||
if( !Pgm().UseSystemPdfBrowser() ) // Run the preferred PDF Browser
|
||||
{
|
||||
command = Pgm().GetPdfBrowserName() + wxT( " " ) + filename;
|
||||
#ifdef __WXMSW__
|
||||
// Windows requires double quotes around the filename to handle spaces
|
||||
command = Pgm().GetPdfBrowserName() + wxT( " \"" ) + filename + wxT( "\"" );
|
||||
#else
|
||||
command = Pgm().GetPdfBrowserName() + wxT( " '" ) + filename + wxT( "'" );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if( wxLaunchDefaultApplication( filename ) )
|
||||
return true;
|
||||
|
||||
#ifdef __WXMAC__
|
||||
command = wxT( "/usr/bin/open -a '" ) + filename + wxT( "'" );
|
||||
#endif
|
||||
// If launching the system default PDF viewer fails, fall through with empty command
|
||||
// string so the error message is displayed.
|
||||
}
|
||||
|
||||
if( !command.IsEmpty() )
|
||||
{
|
||||
if( ProcessExecute( command ) )
|
||||
if( ProcessExecute( command ) != -1 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
+7
-36
@@ -1148,45 +1148,16 @@ void ClipAndDrawPoly( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPoints[], int n )
|
||||
}
|
||||
|
||||
|
||||
void GRBezier( EDA_RECT* ClipBox,
|
||||
wxDC* DC,
|
||||
int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2,
|
||||
int x3,
|
||||
int y3,
|
||||
int width,
|
||||
COLOR4D Color )
|
||||
void GRBezier( EDA_RECT* aClipBox, wxDC* aDC,
|
||||
std::vector<wxPoint>& aPoint,
|
||||
int aWidth, COLOR4D aColor )
|
||||
{
|
||||
std::vector<wxPoint> points;
|
||||
std::vector<wxPoint> output;
|
||||
|
||||
BEZIER_POLY converter( x1, y1, x2, y2, x3, y3 );
|
||||
converter.GetPoly( points );
|
||||
BEZIER_POLY converter( aPoint );
|
||||
converter.GetPoly( output, aWidth );
|
||||
|
||||
GRPoly( ClipBox, DC, points.size(), &points[0], false, width, Color, Color );
|
||||
}
|
||||
|
||||
|
||||
void GRBezier( EDA_RECT* ClipBox,
|
||||
wxDC* DC,
|
||||
int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2,
|
||||
int x3,
|
||||
int y3,
|
||||
int x4,
|
||||
int y4,
|
||||
int width,
|
||||
COLOR4D Color )
|
||||
{
|
||||
std::vector<wxPoint> points;
|
||||
|
||||
BEZIER_POLY converter( x1, y1, x2, y2, x3, y3, x4, y4 );
|
||||
converter.GetPoly( points );
|
||||
|
||||
GRPoly( ClipBox, DC, points.size(), &points[0], false, width, Color, Color );
|
||||
GRPoly( aClipBox, aDC, output.size(), &output[0], false, aWidth, aColor, aColor );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -500,7 +500,7 @@ void GRID_TRICKS::onUpdateUI( wxUpdateUIEvent& event )
|
||||
}
|
||||
}
|
||||
|
||||
if( !cursorInSelectedRow )
|
||||
if( !cursorInSelectedRow && cursorRow >= 0 )
|
||||
m_grid->SelectRow( cursorRow );
|
||||
}
|
||||
}
|
||||
|
||||
+50
-50
@@ -39,7 +39,7 @@ static inline size_t hash_board_item( const BOARD_ITEM* aItem, int aFlags )
|
||||
size_t ret = 0;
|
||||
|
||||
if( aFlags & LAYER )
|
||||
ret ^= hash<unsigned long long>{}( aItem->GetLayerSet().to_ullong() );
|
||||
ret = hash<unsigned long long>{}( aItem->GetLayerSet().to_ullong() );
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -55,57 +55,57 @@ size_t hash_eda( const EDA_ITEM* aItem, int aFlags )
|
||||
{
|
||||
const MODULE* module = static_cast<const MODULE*>( aItem );
|
||||
|
||||
ret ^= hash_board_item( module, aFlags );
|
||||
ret += hash_board_item( module, aFlags );
|
||||
|
||||
if( aFlags & POSITION )
|
||||
{
|
||||
ret ^= hash<int>{}( module->GetPosition().x );
|
||||
ret ^= hash<int>{}( module->GetPosition().y );
|
||||
ret += hash<int>{}( module->GetPosition().x );
|
||||
ret += hash<int>{}( module->GetPosition().y );
|
||||
}
|
||||
|
||||
if( aFlags & ROTATION )
|
||||
ret ^= hash<double>{}( module->GetOrientation() );
|
||||
ret += hash<double>{}( module->GetOrientation() );
|
||||
|
||||
for( const BOARD_ITEM* i = module->GraphicalItemsList(); i; i = i->Next() )
|
||||
ret ^= hash_eda( i, aFlags );
|
||||
ret += hash_eda( i, aFlags );
|
||||
|
||||
for( const D_PAD* i = module->PadsList(); i; i = i->Next() )
|
||||
ret ^= hash_eda( i, aFlags );
|
||||
ret += hash_eda( i, aFlags );
|
||||
}
|
||||
break;
|
||||
|
||||
case PCB_PAD_T:
|
||||
{
|
||||
const D_PAD* pad = static_cast<const D_PAD*>( aItem );
|
||||
ret ^= hash_board_item( pad, aFlags );
|
||||
ret ^= hash<int>{}( pad->GetShape() << 16 );
|
||||
ret ^= hash<int>{}( pad->GetDrillShape() << 18 );
|
||||
ret ^= hash<int>{}( pad->GetSize().x << 8 );
|
||||
ret ^= hash<int>{}( pad->GetSize().y << 9 );
|
||||
ret ^= hash<int>{}( pad->GetOffset().x << 6 );
|
||||
ret ^= hash<int>{}( pad->GetOffset().y << 7 );
|
||||
ret ^= hash<int>{}( pad->GetDelta().x << 4 );
|
||||
ret ^= hash<int>{}( pad->GetDelta().y << 5 );
|
||||
ret += hash_board_item( pad, aFlags );
|
||||
ret += hash<int>{}( pad->GetShape() << 16 );
|
||||
ret += hash<int>{}( pad->GetDrillShape() << 18 );
|
||||
ret += hash<int>{}( pad->GetSize().x << 8 );
|
||||
ret += hash<int>{}( pad->GetSize().y << 9 );
|
||||
ret += hash<int>{}( pad->GetOffset().x << 6 );
|
||||
ret += hash<int>{}( pad->GetOffset().y << 7 );
|
||||
ret += hash<int>{}( pad->GetDelta().x << 4 );
|
||||
ret += hash<int>{}( pad->GetDelta().y << 5 );
|
||||
|
||||
if( aFlags & POSITION )
|
||||
{
|
||||
if( aFlags & REL_COORD )
|
||||
{
|
||||
ret ^= hash<int>{}( pad->GetPos0().x );
|
||||
ret ^= hash<int>{}( pad->GetPos0().y );
|
||||
ret += hash<int>{}( pad->GetPos0().x );
|
||||
ret += hash<int>{}( pad->GetPos0().y );
|
||||
}
|
||||
else
|
||||
{
|
||||
ret ^= hash<int>{}( pad->GetPosition().x );
|
||||
ret ^= hash<int>{}( pad->GetPosition().y );
|
||||
ret += hash<int>{}( pad->GetPosition().x );
|
||||
ret += hash<int>{}( pad->GetPosition().y );
|
||||
}
|
||||
}
|
||||
|
||||
if( aFlags & ROTATION )
|
||||
ret ^= hash<double>{}( pad->GetOrientation() );
|
||||
ret += hash<double>{}( pad->GetOrientation() );
|
||||
|
||||
if( aFlags & NET )
|
||||
ret ^= hash<int>{}( pad->GetNetCode() << 6 );
|
||||
ret += hash<int>{}( pad->GetNetCode() << 6 );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -119,64 +119,64 @@ size_t hash_eda( const EDA_ITEM* aItem, int aFlags )
|
||||
if( !( aFlags & VALUE ) && text->GetType() == TEXTE_MODULE::TEXT_is_VALUE )
|
||||
break;
|
||||
|
||||
ret ^= hash_board_item( text, aFlags );
|
||||
ret ^= hash<string>{}( text->GetText().ToStdString() );
|
||||
ret ^= hash<bool>{}( text->IsItalic() );
|
||||
ret ^= hash<bool>{}( text->IsBold() );
|
||||
ret ^= hash<bool>{}( text->IsMirrored() );
|
||||
ret ^= hash<int>{}( text->GetTextWidth() );
|
||||
ret ^= hash<int>{}( text->GetTextHeight() );
|
||||
ret ^= hash<int>{}( text->GetHorizJustify() );
|
||||
ret ^= hash<int>{}( text->GetVertJustify() );
|
||||
ret += hash_board_item( text, aFlags );
|
||||
ret += hash<string>{}( text->GetText().ToStdString() );
|
||||
ret += hash<bool>{}( text->IsItalic() );
|
||||
ret += hash<bool>{}( text->IsBold() );
|
||||
ret += hash<bool>{}( text->IsMirrored() );
|
||||
ret += hash<int>{}( text->GetTextWidth() );
|
||||
ret += hash<int>{}( text->GetTextHeight() );
|
||||
ret += hash<int>{}( text->GetHorizJustify() );
|
||||
ret += hash<int>{}( text->GetVertJustify() );
|
||||
|
||||
if( aFlags & POSITION )
|
||||
{
|
||||
if( aFlags & REL_COORD )
|
||||
{
|
||||
ret ^= hash<int>{}( text->GetPos0().x );
|
||||
ret ^= hash<int>{}( text->GetPos0().y );
|
||||
ret += hash<int>{}( text->GetPos0().x );
|
||||
ret += hash<int>{}( text->GetPos0().y );
|
||||
}
|
||||
else
|
||||
{
|
||||
ret ^= hash<int>{}( text->GetPosition().x );
|
||||
ret ^= hash<int>{}( text->GetPosition().y );
|
||||
ret += hash<int>{}( text->GetPosition().x );
|
||||
ret += hash<int>{}( text->GetPosition().y );
|
||||
}
|
||||
}
|
||||
|
||||
if( aFlags & ROTATION )
|
||||
ret ^= hash<double>{}( text->GetTextAngle() );
|
||||
ret += hash<double>{}( text->GetTextAngle() );
|
||||
}
|
||||
break;
|
||||
|
||||
case PCB_MODULE_EDGE_T:
|
||||
{
|
||||
const EDGE_MODULE* segment = static_cast<const EDGE_MODULE*>( aItem );
|
||||
ret ^= hash_board_item( segment, aFlags );
|
||||
ret ^= hash<int>{}( segment->GetType() );
|
||||
ret ^= hash<int>{}( segment->GetShape() );
|
||||
ret ^= hash<int>{}( segment->GetWidth() );
|
||||
ret ^= hash<int>{}( segment->GetRadius() );
|
||||
ret += hash_board_item( segment, aFlags );
|
||||
ret += hash<int>{}( segment->GetType() );
|
||||
ret += hash<int>{}( segment->GetShape() );
|
||||
ret += hash<int>{}( segment->GetWidth() );
|
||||
ret += hash<int>{}( segment->GetRadius() );
|
||||
|
||||
if( aFlags & POSITION )
|
||||
{
|
||||
if( aFlags & REL_COORD )
|
||||
{
|
||||
ret ^= hash<int>{}( segment->GetStart0().x );
|
||||
ret ^= hash<int>{}( segment->GetStart0().y );
|
||||
ret ^= hash<int>{}( segment->GetEnd0().x );
|
||||
ret ^= hash<int>{}( segment->GetEnd0().y );
|
||||
ret += hash<int>{}( segment->GetStart0().x );
|
||||
ret += hash<int>{}( segment->GetStart0().y );
|
||||
ret += hash<int>{}( segment->GetEnd0().x );
|
||||
ret += hash<int>{}( segment->GetEnd0().y );
|
||||
}
|
||||
else
|
||||
{
|
||||
ret ^= hash<int>{}( segment->GetStart().x );
|
||||
ret ^= hash<int>{}( segment->GetStart().y );
|
||||
ret ^= hash<int>{}( segment->GetEnd().x );
|
||||
ret ^= hash<int>{}( segment->GetEnd().y );
|
||||
ret += hash<int>{}( segment->GetStart().x );
|
||||
ret += hash<int>{}( segment->GetStart().y );
|
||||
ret += hash<int>{}( segment->GetEnd().x );
|
||||
ret += hash<int>{}( segment->GetEnd().y );
|
||||
}
|
||||
}
|
||||
|
||||
if( aFlags & ROTATION )
|
||||
ret ^= hash<double>{}( segment->GetAngle() );
|
||||
ret += hash<double>{}( segment->GetAngle() );
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -28,16 +28,20 @@
|
||||
#include <common.h>
|
||||
|
||||
|
||||
HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* parent, const wxString& aTitle) :
|
||||
DIALOG_DISPLAY_HTML_TEXT_BASE( parent, wxID_ANY, aTitle )
|
||||
HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* aParent, const wxString& aTitle,
|
||||
const wxPoint& aPosition, const wxSize& aSize ) :
|
||||
DIALOG_DISPLAY_HTML_TEXT_BASE( aParent, wxID_ANY, aTitle, aPosition, aSize )
|
||||
{
|
||||
m_htmlWindow->SetLayoutDirection( wxLayout_LeftToRight );
|
||||
ListClear();
|
||||
|
||||
// Gives a default logical size (the actual size depends on the display definition)
|
||||
SetSizeInDU( 320, 120 );
|
||||
if( aSize != wxDefaultSize )
|
||||
SetSizeInDU( aSize.x, aSize.y );
|
||||
|
||||
Center();
|
||||
|
||||
m_sdbSizer1OK->SetDefault();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,12 +53,14 @@ HTML_MESSAGE_BOX::~HTML_MESSAGE_BOX()
|
||||
}
|
||||
|
||||
|
||||
void HTML_MESSAGE_BOX::OnCloseButtonClick( wxCommandEvent& event )
|
||||
void HTML_MESSAGE_BOX::OnOKButtonClick( wxCommandEvent& event )
|
||||
{
|
||||
// the dialog can be shown modal or not modal.
|
||||
// the dialog can be shown quasi-model, modal, or not modeless.
|
||||
// therefore, use the right way to close it.
|
||||
if( IsModal() )
|
||||
EndModal( 0 );
|
||||
if( IsQuasiModal() )
|
||||
EndQuasiModal( wxID_OK );
|
||||
else if( IsModal() )
|
||||
EndModal( wxID_OK );
|
||||
else
|
||||
Destroy();
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ void KIWAY::SetTop( wxFrame* aTop )
|
||||
const wxString KIWAY::dso_search_path( FACE_T aFaceId )
|
||||
{
|
||||
const char* name;
|
||||
const char* dirName;
|
||||
|
||||
switch( aFaceId )
|
||||
{
|
||||
@@ -110,6 +111,13 @@ const wxString KIWAY::dso_search_path( FACE_T aFaceId )
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
// The subdirectories usually have the same name as the kiface
|
||||
switch( aFaceId )
|
||||
{
|
||||
case FACE_PL_EDITOR: dirName = "pagelayout_editor"; break;
|
||||
default: dirName = name + 1; break;
|
||||
}
|
||||
|
||||
#ifndef __WXMAC__
|
||||
wxString path;
|
||||
|
||||
@@ -131,6 +139,25 @@ const wxString KIWAY::dso_search_path( FACE_T aFaceId )
|
||||
|
||||
fn.SetName( name );
|
||||
|
||||
#ifdef DEBUG
|
||||
// To speed up development, it's sometimes nice to run kicad from inside
|
||||
// the build path. In that case, each program will be in a subdirectory.
|
||||
// To find the DSOs, we need to go up one directory and then enter a subdirectory.
|
||||
|
||||
if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
fn = wxStandardPaths::Get().GetExecutablePath();
|
||||
fn.RemoveLastDir();
|
||||
fn.AppendDir( wxT( "PlugIns" ) );
|
||||
fn.SetName( name );
|
||||
#else
|
||||
fn.RemoveLastDir();
|
||||
fn.AppendDir( dirName );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// Here a "suffix" == an extension with a preceding '.',
|
||||
// so skip the preceding '.' to get an extension
|
||||
fn.SetExt( KIFACE_SUFFIX + 1 ); // + 1 => &KIFACE_SUFFIX[1]
|
||||
|
||||
@@ -613,7 +613,7 @@ void EDA_DRAW_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||
|
||||
void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
|
||||
{
|
||||
SetStatusText( msg, 5 );
|
||||
SetStatusText( msg, 6 );
|
||||
}
|
||||
|
||||
|
||||
@@ -672,6 +672,23 @@ void EDA_DRAW_FRAME::OnSize( wxSizeEvent& SizeEv )
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::OnMove( wxMoveEvent& aEvent )
|
||||
{
|
||||
// If the window is moved to a different display, the scaling factor may change
|
||||
double oldFactor = m_galDisplayOptions.m_scaleFactor;
|
||||
m_galDisplayOptions.UpdateScaleFactor();
|
||||
|
||||
if( oldFactor != m_galDisplayOptions.m_scaleFactor )
|
||||
{
|
||||
wxSize clientSize = GetClientSize();
|
||||
GetGalCanvas()->GetGAL()->ResizeScreen( clientSize.x, clientSize.y );
|
||||
GetGalCanvas()->GetView()->MarkDirty();
|
||||
}
|
||||
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
|
||||
{
|
||||
// Keep default cursor in toolbars
|
||||
|
||||
@@ -621,7 +621,7 @@ void EDA_DRAW_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||
|
||||
void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
|
||||
{
|
||||
SetStatusText( msg, 5 );
|
||||
SetStatusText( msg, 6 );
|
||||
}
|
||||
|
||||
|
||||
@@ -687,6 +687,12 @@ void EDA_DRAW_FRAME::OnSize( wxSizeEvent& SizeEv )
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::OnMove( wxMoveEvent& aEvent )
|
||||
{
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
|
||||
{
|
||||
// Keep default cursor in toolbars
|
||||
|
||||
@@ -398,6 +398,12 @@ std::vector<wxString> LIB_TABLE::GetLogicalLibs()
|
||||
ret.push_back( *it );
|
||||
}
|
||||
|
||||
// We want to allow case-sensitive duplicates but sort by case-insensitive ordering
|
||||
std::sort( ret.begin(), ret.end(), []( const wxString& lhs, const wxString& rhs )
|
||||
{
|
||||
return lhs.CmpNoCase( rhs ) < 0;
|
||||
} );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
+8
-5
@@ -286,17 +286,20 @@ std::string LSET::FmtHex() const
|
||||
|
||||
static const char hex[] = "0123456789abcdef";
|
||||
|
||||
int nibble_count = ( size() + 3 ) / 4;
|
||||
unsigned nibble_count = ( size() + 3 ) / 4;
|
||||
|
||||
for( int nibble=0; nibble<nibble_count; ++nibble )
|
||||
for( unsigned nibble = 0; nibble < nibble_count; ++nibble )
|
||||
{
|
||||
unsigned ndx = 0;
|
||||
|
||||
// test 4 consecutive bits and set ndx to 0-15:
|
||||
for( int nibble_bit=0; nibble_bit<4; ++nibble_bit )
|
||||
for( unsigned nibble_bit = 0; nibble_bit < 4; ++nibble_bit )
|
||||
{
|
||||
if( (*this)[nibble_bit + nibble*4] )
|
||||
ndx |= (1 << nibble_bit);
|
||||
if( ( nibble_bit + nibble * 4 ) >= size() )
|
||||
break;
|
||||
|
||||
if( (*this)[nibble_bit + nibble * 4] )
|
||||
ndx |= ( 1 << nibble_bit );
|
||||
}
|
||||
|
||||
if( nibble && !( nibble % 8 ) )
|
||||
|
||||
+249
-145
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2020 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
|
||||
@@ -217,6 +217,10 @@ bool GERBER_PLOTTER::StartPlot()
|
||||
// Be sure the usual dark polarity is selected:
|
||||
fputs( "%LPD*%\n", outputFile );
|
||||
|
||||
// Set initial interpolation mode: always G01 (linear):
|
||||
fputs( "G01*\n", outputFile );
|
||||
|
||||
// Set aperture list starting point:
|
||||
fputs( "G04 APERTURE LIST*\n", outputFile );
|
||||
|
||||
return true;
|
||||
@@ -327,10 +331,7 @@ void GERBER_PLOTTER::selectAperture( const wxSize& aSize,
|
||||
( currentAperture->m_Type != aType ) ||
|
||||
( currentAperture->m_Size != aSize );
|
||||
|
||||
if( !m_useNetAttributes )
|
||||
aApertureAttribute = 0;
|
||||
else
|
||||
change = change || ( currentAperture->m_ApertureAttribute != aApertureAttribute );
|
||||
change = change || ( currentAperture->m_ApertureAttribute != aApertureAttribute );
|
||||
|
||||
if( change )
|
||||
{
|
||||
@@ -474,21 +475,34 @@ void GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAn
|
||||
{
|
||||
SetCurrentLineWidth( aWidth );
|
||||
|
||||
// aFill is not used here.
|
||||
plotArc( aCenter, aStAngle, aEndAngle, aRadius, false );
|
||||
}
|
||||
|
||||
|
||||
void GERBER_PLOTTER::plotArc( const wxPoint& aCenter, double aStAngle, double aEndAngle,
|
||||
int aRadius, bool aPlotInRegion )
|
||||
{
|
||||
wxPoint start, end;
|
||||
start.x = aCenter.x + KiROUND( cosdecideg( aRadius, aStAngle ) );
|
||||
start.y = aCenter.y - KiROUND( sindecideg( aRadius, aStAngle ) );
|
||||
MoveTo( start );
|
||||
|
||||
if( !aPlotInRegion )
|
||||
MoveTo( start );
|
||||
else
|
||||
LineTo( start );
|
||||
|
||||
end.x = aCenter.x + KiROUND( cosdecideg( aRadius, aEndAngle ) );
|
||||
end.y = aCenter.y - KiROUND( sindecideg( aRadius, aEndAngle ) );
|
||||
DPOINT devEnd = userToDeviceCoordinates( end );
|
||||
DPOINT devCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start );
|
||||
|
||||
fprintf( outputFile, "G75*\n" ); // Multiquadrant (360 degrees) mode
|
||||
fprintf( outputFile, "G75*\n" ); // Multiquadrant (360 degrees) mode
|
||||
|
||||
if( aStAngle < aEndAngle )
|
||||
fprintf( outputFile, "G03" );
|
||||
fprintf( outputFile, "G03*\n" ); // Active circular interpolation, CCW
|
||||
else
|
||||
fprintf( outputFile, "G02" );
|
||||
fprintf( outputFile, "G02*\n" ); // Active circular interpolation, CW
|
||||
|
||||
fprintf( outputFile, "X%dY%dI%dJ%dD01*\n",
|
||||
KiROUND( devEnd.x ), KiROUND( devEnd.y ),
|
||||
@@ -498,7 +512,45 @@ void GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAn
|
||||
}
|
||||
|
||||
|
||||
void GERBER_PLOTTER:: PlotPoly( const std::vector< wxPoint >& aCornerList,
|
||||
void GERBER_PLOTTER::PlotGerberRegion( const std::vector< wxPoint >& aCornerList,
|
||||
void * aData )
|
||||
{
|
||||
if( aCornerList.size() <= 2 )
|
||||
return;
|
||||
|
||||
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
|
||||
|
||||
bool clearTA_AperFunction = false; // true if a TA.AperFunction is used
|
||||
|
||||
if( gbr_metadata )
|
||||
{
|
||||
std::string attrib = gbr_metadata->m_ApertureMetadata.FormatAttribute( !m_useX2format );
|
||||
|
||||
if( !attrib.empty() )
|
||||
{
|
||||
fputs( attrib.c_str(), outputFile );
|
||||
clearTA_AperFunction = true;
|
||||
}
|
||||
}
|
||||
|
||||
PlotPoly( aCornerList, FILLED_SHAPE, 0 , gbr_metadata );
|
||||
|
||||
// Clear the TA attribute, to avoid the next item to inherit it:
|
||||
if( clearTA_AperFunction )
|
||||
{
|
||||
if( m_useX2format )
|
||||
{
|
||||
fputs( "%TD.AperFunction*%\n", outputFile );
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs( "G04 #@! TD.AperFunction*\n", outputFile );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
|
||||
FILL_T aFill, int aWidth, void * aData )
|
||||
{
|
||||
if( aCornerList.size() <= 1 )
|
||||
@@ -524,7 +576,10 @@ void GERBER_PLOTTER:: PlotPoly( const std::vector< wxPoint >& aCornerList,
|
||||
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
|
||||
LineTo( aCornerList[ii] );
|
||||
|
||||
FinishTo( aCornerList[0] );
|
||||
// If the polygon is not closed, close it:
|
||||
if( aCornerList[0] != aCornerList[aCornerList.size()-1] )
|
||||
FinishTo( aCornerList[0] );
|
||||
|
||||
fputs( "G37*\n", outputFile );
|
||||
}
|
||||
|
||||
@@ -676,7 +731,7 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, doub
|
||||
wxSize size( aSize );
|
||||
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
|
||||
|
||||
/* Plot a flashed shape. */
|
||||
// Flash a vertical or horizontal shape (this is a basic aperture).
|
||||
if( ( orient == 0 || orient == 900 || orient == 1800 || orient == 2700 )
|
||||
&& trace_mode == FILLED )
|
||||
{
|
||||
@@ -692,56 +747,29 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, doub
|
||||
|
||||
emitDcode( pos_dev, 3 );
|
||||
}
|
||||
else /* Plot pad as a segment. */
|
||||
else // Plot pad as region.
|
||||
// Only regions and flashed items accept a object attribute TO.P for the pin name
|
||||
{
|
||||
if( size.x > size.y )
|
||||
{
|
||||
std::swap( size.x, size.y );
|
||||
|
||||
if( orient < 2700 )
|
||||
orient += 900;
|
||||
else
|
||||
orient -= 2700;
|
||||
}
|
||||
|
||||
if( trace_mode == FILLED )
|
||||
{
|
||||
// TODO: use an aperture macro to declare the rotated pad
|
||||
|
||||
// Flash a pad anchor, if a netlist attribute is set
|
||||
if( aData )
|
||||
FlashPadCircle( pos, size.x, trace_mode, aData );
|
||||
|
||||
// The pad is reduced to an segment with dy > dx
|
||||
int delta = size.y - size.x;
|
||||
int x0 = 0;
|
||||
int y0 = -delta / 2;
|
||||
int x1 = 0;
|
||||
int y1 = delta / 2;
|
||||
RotatePoint( &x0, &y0, orient );
|
||||
RotatePoint( &x1, &y1, orient );
|
||||
GBR_METADATA metadata;
|
||||
|
||||
if( gbr_metadata )
|
||||
// Draw the oval as round rect pad with a radius = 50% min size)
|
||||
// In gerber file, it will be drawn as a region with arcs, and can be
|
||||
// detected as pads (similar to a flashed pad)
|
||||
FlashPadRoundRect( pos, aSize, std::min( aSize.x, aSize.y ) /2,
|
||||
orient, FILLED, aData );
|
||||
}
|
||||
else // Non filled shape: plot outlines:
|
||||
{
|
||||
if( size.x > size.y )
|
||||
{
|
||||
metadata = *gbr_metadata;
|
||||
std::swap( size.x, size.y );
|
||||
|
||||
// If the pad is drawn on a copper layer,
|
||||
// set attribute to GBR_APERTURE_ATTRIB_CONDUCTOR
|
||||
if( metadata.IsCopper() )
|
||||
metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONDUCTOR );
|
||||
|
||||
// Clear .P attribute, only allowed for flashed items
|
||||
wxString attrname( ".P" );
|
||||
metadata.m_NetlistMetadata.ClearAttribute( &attrname );
|
||||
if( orient < 2700 )
|
||||
orient += 900;
|
||||
else
|
||||
orient -= 2700;
|
||||
}
|
||||
|
||||
ThickSegment( wxPoint( pos.x + x0, pos.y + y0 ),
|
||||
wxPoint( pos.x + x1, pos.y + y1 ),
|
||||
size.x, trace_mode, &metadata );
|
||||
}
|
||||
else
|
||||
{
|
||||
sketchOval( pos, size, orient, -1 );
|
||||
}
|
||||
}
|
||||
@@ -821,83 +849,186 @@ void GERBER_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
|
||||
EDA_DRAW_MODE_T aTraceMode, void* aData )
|
||||
|
||||
{
|
||||
GBR_METADATA gbr_metadata;
|
||||
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
|
||||
|
||||
if( aData )
|
||||
if( aTraceMode != FILLED )
|
||||
{
|
||||
gbr_metadata = *static_cast<GBR_METADATA*>( aData );
|
||||
// If the pad is drawn on a copper layer,
|
||||
// set attribute to GBR_APERTURE_ATTRIB_CONDUCTOR
|
||||
if( gbr_metadata.IsCopper() )
|
||||
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONDUCTOR );
|
||||
SHAPE_POLY_SET outline;
|
||||
const int segmentToCircleCount = 64;
|
||||
TransformRoundRectToPolygon( outline, aPadPos, aSize, aOrient,
|
||||
aCornerRadius, segmentToCircleCount );
|
||||
|
||||
wxString attrname( ".P" );
|
||||
gbr_metadata.m_NetlistMetadata.ClearAttribute( &attrname ); // not allowed on inner layers
|
||||
}
|
||||
|
||||
if( aTraceMode != FILLED )
|
||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, &gbr_metadata );
|
||||
|
||||
// Currently, a Pad RoundRect is plotted as polygon.
|
||||
// TODO: use Aperture macro and flash it
|
||||
SHAPE_POLY_SET outline;
|
||||
const int segmentToCircleCount = 64;
|
||||
TransformRoundRectToPolygon( outline, aPadPos, aSize, aOrient,
|
||||
aCornerRadius, segmentToCircleCount );
|
||||
|
||||
if( aTraceMode != FILLED )
|
||||
outline.Inflate( -GetCurrentLineWidth()/2, 16 );
|
||||
|
||||
std::vector< wxPoint > cornerList;
|
||||
// TransformRoundRectToPolygon creates only one convex polygon
|
||||
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
|
||||
cornerList.reserve( poly.PointCount() + 1 );
|
||||
std::vector< wxPoint > cornerList;
|
||||
// TransformRoundRectToPolygon creates only one convex polygon
|
||||
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
|
||||
cornerList.reserve( poly.PointCount() + 1 );
|
||||
|
||||
for( int ii = 0; ii < poly.PointCount(); ++ii )
|
||||
cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
|
||||
for( int ii = 0; ii < poly.PointCount(); ++ii )
|
||||
cornerList.emplace_back( poly.CPoint( ii ).x, poly.CPoint( ii ).y );
|
||||
|
||||
// Close polygon
|
||||
cornerList.push_back( cornerList[0] );
|
||||
// Close polygon
|
||||
cornerList.push_back( cornerList[0] );
|
||||
|
||||
PlotPoly( cornerList, aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL,
|
||||
aTraceMode == FILLED ? 0 : GetCurrentLineWidth(), &gbr_metadata );
|
||||
|
||||
// Now, flash a pad anchor, if a netlist attribute is set
|
||||
// (remove me when a Aperture macro will be used)
|
||||
if( aData && aTraceMode == FILLED )
|
||||
// plot outlines
|
||||
PlotPoly( cornerList, NO_FILL, GetCurrentLineWidth(), gbr_metadata );
|
||||
}
|
||||
else
|
||||
{
|
||||
int diameter = std::min( aSize.x, aSize.y );
|
||||
FlashPadCircle( aPadPos, diameter, aTraceMode , aData );
|
||||
// A Pad RoundRect is plotted as a Gerber region.
|
||||
// Initialize region metadata:
|
||||
bool clearTA_AperFunction = false; // true if a TA.AperFunction is used
|
||||
|
||||
if( gbr_metadata )
|
||||
{
|
||||
formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
|
||||
std::string attrib = gbr_metadata->m_ApertureMetadata.FormatAttribute( !m_useX2format );
|
||||
|
||||
if( !attrib.empty() )
|
||||
{
|
||||
fputs( attrib.c_str(), outputFile );
|
||||
clearTA_AperFunction = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Plot the region using arcs in corners.
|
||||
plotRoundRectAsRegion( aPadPos, aSize, aCornerRadius, aOrient );
|
||||
|
||||
// Clear the TA attribute, to avoid the next item to inherit it:
|
||||
if( clearTA_AperFunction )
|
||||
{
|
||||
if( m_useX2format )
|
||||
{
|
||||
fputs( "%TD.AperFunction*%\n", outputFile );
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs( "G04 #@! TD.AperFunction*\n", outputFile );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GERBER_PLOTTER::plotRoundRectAsRegion( const wxPoint& aRectCenter, const wxSize& aSize,
|
||||
int aCornerRadius, double aOrient )
|
||||
{
|
||||
// The region outline is generated by 4 sides and 4 90 deg arcs
|
||||
// 1 --- 2
|
||||
// | c |
|
||||
// 4 --- 3
|
||||
|
||||
// Note also in user coordinates the Y axis is from top to bottom
|
||||
// for historical reasons.
|
||||
|
||||
// A helper structure to handle outlines coordinates (segments and arcs)
|
||||
// in user coordinates
|
||||
struct RR_EDGE
|
||||
{
|
||||
wxPoint m_start;
|
||||
wxPoint m_end;
|
||||
wxPoint m_center;
|
||||
// in decidegrees: angle start. angle end = m_arc_angle_start+arc_angle
|
||||
double m_arc_angle_start;
|
||||
};
|
||||
|
||||
const double arc_angle = -900.0; // in decidegrees
|
||||
int hsizeX = aSize.x/2;
|
||||
int hsizeY = aSize.y/2;
|
||||
|
||||
RR_EDGE curr_edge;
|
||||
std::vector<RR_EDGE> rr_outline;
|
||||
|
||||
// Build outline coordinates, relative to rectangle center, rotation 0:
|
||||
|
||||
// Top left corner 1 (and 4 to 1 left vertical side @ x=-hsizeX)
|
||||
curr_edge.m_start.x = -hsizeX;
|
||||
curr_edge.m_start.y = hsizeY - aCornerRadius;
|
||||
curr_edge.m_end.x = curr_edge.m_start.x;
|
||||
curr_edge.m_end.y = -hsizeY + aCornerRadius;
|
||||
curr_edge.m_center.x = -hsizeX + aCornerRadius;
|
||||
curr_edge.m_center.y = curr_edge.m_end.y;
|
||||
curr_edge.m_arc_angle_start = aOrient + 1800.0; // En decidegree
|
||||
|
||||
rr_outline.push_back( curr_edge );
|
||||
|
||||
// Top right corner 2 (and 1 to 2 top horizontal side @ y=-hsizeY)
|
||||
curr_edge.m_start.x = -hsizeX + aCornerRadius;
|
||||
curr_edge.m_start.y = -hsizeY;
|
||||
curr_edge.m_end.x = hsizeX - aCornerRadius;
|
||||
curr_edge.m_end.y = curr_edge.m_start.y;
|
||||
curr_edge.m_center.x = curr_edge.m_end.x;
|
||||
curr_edge.m_center.y = -hsizeY + aCornerRadius;
|
||||
curr_edge.m_arc_angle_start = aOrient + 900.0; // En decidegree
|
||||
|
||||
rr_outline.push_back( curr_edge );
|
||||
|
||||
// bottom right corner 3 (and 2 to 3 right vertical side @ x=hsizeX)
|
||||
curr_edge.m_start.x = hsizeX;
|
||||
curr_edge.m_start.y = -hsizeY + aCornerRadius;
|
||||
curr_edge.m_end.x = curr_edge.m_start.x;
|
||||
curr_edge.m_end.y = hsizeY - aCornerRadius;
|
||||
curr_edge.m_center.x = hsizeX - aCornerRadius;
|
||||
curr_edge.m_center.y = curr_edge.m_end.y;
|
||||
curr_edge.m_arc_angle_start = aOrient + 0.0; // En decidegree
|
||||
|
||||
rr_outline.push_back( curr_edge );
|
||||
|
||||
// bottom left corner 4 (and 3 to 4 bottom horizontal side @ y=hsizeY)
|
||||
curr_edge.m_start.x = hsizeX - aCornerRadius;
|
||||
curr_edge.m_start.y = hsizeY;
|
||||
curr_edge.m_end.x = -hsizeX + aCornerRadius;
|
||||
curr_edge.m_end.y = curr_edge.m_start.y;
|
||||
curr_edge.m_center.x = curr_edge.m_end.x;
|
||||
curr_edge.m_center.y = hsizeY - aCornerRadius;
|
||||
curr_edge.m_arc_angle_start = aOrient - 900.0; // En decidegree
|
||||
|
||||
rr_outline.push_back( curr_edge );
|
||||
|
||||
// Move relative coordinates to the actual location and rotation:
|
||||
for( RR_EDGE& rr_edge: rr_outline )
|
||||
{
|
||||
RotatePoint( &rr_edge.m_start, aOrient );
|
||||
RotatePoint( &rr_edge.m_end, aOrient );
|
||||
RotatePoint( &rr_edge.m_center, aOrient );
|
||||
rr_edge.m_start += aRectCenter;
|
||||
rr_edge.m_end += aRectCenter;
|
||||
rr_edge.m_center += aRectCenter;
|
||||
}
|
||||
|
||||
fputs( "G36*\n", outputFile ); // Start region
|
||||
fputs( "G01*\n", outputFile ); // Set linear interpolation.
|
||||
MoveTo( rr_outline[0].m_start ); // Start point of region
|
||||
|
||||
for( RR_EDGE& rr_edge: rr_outline )
|
||||
{
|
||||
if( aCornerRadius ) // Guard: ensure we do not create arcs with radius = 0
|
||||
{
|
||||
// LineTo( rr_edge.m_end ); // made in plotArc()
|
||||
plotArc( rr_edge.m_center, rr_edge.m_arc_angle_start, rr_edge.m_arc_angle_start+arc_angle,
|
||||
aCornerRadius, true );
|
||||
}
|
||||
else
|
||||
LineTo( rr_edge.m_end );
|
||||
}
|
||||
|
||||
fputs( "G37*\n", outputFile ); // Close region
|
||||
}
|
||||
|
||||
|
||||
void GERBER_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
|
||||
SHAPE_POLY_SET* aPolygons,
|
||||
EDA_DRAW_MODE_T aTraceMode, void* aData )
|
||||
|
||||
{
|
||||
// A Pad custom is plotted as polygon.
|
||||
|
||||
// A flashed circle @aPadPos is added (anchor pad)
|
||||
// However, because the anchor pad can be circle or rect, we use only
|
||||
// a circle not bigger than the rect.
|
||||
// the main purpose is to print a flashed DCode as pad anchor
|
||||
if( aTraceMode == FILLED )
|
||||
FlashPadCircle( aPadPos, std::min( aSize.x, aSize.y ), aTraceMode, aData );
|
||||
// A Pad custom is plotted as Gerber region.
|
||||
|
||||
GBR_METADATA gbr_metadata;
|
||||
|
||||
if( aData )
|
||||
{
|
||||
gbr_metadata = *static_cast<GBR_METADATA*>( aData );
|
||||
// If the pad is drawn on a copper layer,
|
||||
// set attribute to GBR_APERTURE_ATTRIB_CONDUCTOR
|
||||
if( gbr_metadata.IsCopper() )
|
||||
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONDUCTOR );
|
||||
|
||||
wxString attrname( ".P" );
|
||||
gbr_metadata.m_NetlistMetadata.ClearAttribute( &attrname ); // not allowed on inner layers
|
||||
}
|
||||
|
||||
SHAPE_POLY_SET polyshape = *aPolygons;
|
||||
|
||||
@@ -921,9 +1052,10 @@ void GERBER_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize
|
||||
// Close polygon
|
||||
cornerList.push_back( cornerList[0] );
|
||||
|
||||
PlotPoly( cornerList,
|
||||
aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL,
|
||||
aTraceMode == FILLED ? 0 : GetCurrentLineWidth(), &gbr_metadata );
|
||||
if( aTraceMode == SKETCH )
|
||||
PlotPoly( cornerList, NO_FILL, GetCurrentLineWidth(), &gbr_metadata );
|
||||
else
|
||||
PlotGerberRegion( cornerList, &gbr_metadata );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -941,25 +1073,6 @@ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCo
|
||||
for( int ii = 0; ii < 4; ii++ )
|
||||
cornerList.push_back( aCorners[ii] );
|
||||
|
||||
// Now, flash a pad anchor, if a netlist attribute is set
|
||||
// (remove me when a Aperture macro will be used)
|
||||
if( aData && ( aTrace_Mode == FILLED ) )
|
||||
{
|
||||
// Calculate the radius of the circle inside the shape
|
||||
// It is the smaller dist from shape pos to edges
|
||||
int radius = INT_MAX;
|
||||
|
||||
for( unsigned ii = 0, jj = cornerList.size()-1; ii < cornerList.size();
|
||||
jj = ii, ii++ )
|
||||
{
|
||||
SEG segment( aCorners[ii], aCorners[jj] );
|
||||
int dist = segment.LineDistance( VECTOR2I( 0, 0) );
|
||||
radius = std::min( radius, dist );
|
||||
}
|
||||
|
||||
FlashPadCircle( aPadPos, radius*2, aTrace_Mode, aData );
|
||||
}
|
||||
|
||||
// Draw the polygon and fill the interior as required
|
||||
for( unsigned ii = 0; ii < 4; ii++ )
|
||||
{
|
||||
@@ -974,21 +1087,12 @@ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCo
|
||||
GBR_METADATA metadata;
|
||||
|
||||
if( gbr_metadata )
|
||||
{
|
||||
metadata = *gbr_metadata;
|
||||
// If the pad is drawn on a copper layer,
|
||||
// set attribute to GBR_APERTURE_ATTRIB_CONDUCTOR
|
||||
if( metadata.IsCopper() )
|
||||
metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONDUCTOR );
|
||||
|
||||
wxString attrname( ".P" );
|
||||
metadata.m_NetlistMetadata.ClearAttribute( &attrname ); // not allowed on inner layers
|
||||
}
|
||||
|
||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, &metadata );
|
||||
PlotPoly( cornerList, aTrace_Mode == FILLED ? FILLED_SHAPE : NO_FILL,
|
||||
aTrace_Mode == FILLED ? 0 : GetCurrentLineWidth(),
|
||||
&metadata );
|
||||
if( aTrace_Mode == SKETCH )
|
||||
PlotPoly( cornerList, NO_FILL, USE_DEFAULT_LINE_WIDTH, &metadata );
|
||||
else
|
||||
PlotGerberRegion( cornerList, &metadata );
|
||||
}
|
||||
|
||||
|
||||
|
||||
+149
-19
@@ -6,8 +6,8 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2020 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
|
||||
@@ -90,6 +90,8 @@
|
||||
* flag_sweep : 0 = CCW, 1 = CW
|
||||
* The center of ellipse is automatically calculated.
|
||||
*/
|
||||
|
||||
#include <base64.h>
|
||||
#include <fctsys.h>
|
||||
#include <trigo.h>
|
||||
#include <eda_base_frame.h>
|
||||
@@ -100,6 +102,8 @@
|
||||
#include <macros.h>
|
||||
#include <kicad_string.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <wx/mstream.h>
|
||||
|
||||
|
||||
/**
|
||||
@@ -424,9 +428,6 @@ void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
|
||||
if( StAngle > EndAngle )
|
||||
std::swap( StAngle, EndAngle );
|
||||
|
||||
setFillMode( fill );
|
||||
SetCurrentLineWidth( width );
|
||||
|
||||
// Calculate start point.
|
||||
DPOINT centre_dev = userToDeviceCoordinates( centre );
|
||||
double radius_dev = userToDeviceSize( radius );
|
||||
@@ -487,7 +488,22 @@ void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
|
||||
// flag arc size (0 = small arc > 180 deg, 1 = large arc > 180 deg),
|
||||
// sweep arc ( 0 = CCW, 1 = CW),
|
||||
// end point
|
||||
fprintf( outputFile, "<path d=\"M%g %g A%g %g 0.0 %d %d %g %g \" />\n",
|
||||
if( fill != NO_FILL )
|
||||
{
|
||||
// Filled arcs (in eeschema) consist of the pie wedge and a stroke only on the arc
|
||||
// This needs to be drawn in two steps.
|
||||
setFillMode( fill );
|
||||
SetCurrentLineWidth( 0 );
|
||||
|
||||
fprintf( outputFile, "<path d=\"M%g %g A%g %g 0.0 %d %d %g %g L %g %g Z\" />\n",
|
||||
start.x, start.y, radius_dev, radius_dev,
|
||||
flg_arc, flg_sweep,
|
||||
end.x, end.y, centre_dev.x, centre_dev.y );
|
||||
}
|
||||
|
||||
setFillMode( NO_FILL );
|
||||
SetCurrentLineWidth( width );
|
||||
fprintf( outputFile, "<path d=\"M%g %g A%g %g 0.0 %d %d %g %g\" />\n",
|
||||
start.x, start.y, radius_dev, radius_dev,
|
||||
flg_arc, flg_sweep,
|
||||
end.x, end.y );
|
||||
@@ -517,15 +533,22 @@ void SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
|
||||
}
|
||||
|
||||
DPOINT pos = userToDeviceCoordinates( aCornerList[0] );
|
||||
fprintf( outputFile, "d=\"M %d,%d\n", (int) pos.x, (int) pos.y );
|
||||
fprintf( outputFile, "d=\"M %g,%g\n", pos.x, pos.y );
|
||||
|
||||
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
|
||||
for( unsigned ii = 1; ii < aCornerList.size() - 1; ii++ )
|
||||
{
|
||||
pos = userToDeviceCoordinates( aCornerList[ii] );
|
||||
fprintf( outputFile, "%d,%d\n", (int) pos.x, (int) pos.y );
|
||||
fprintf( outputFile, "%g,%g\n", pos.x, pos.y );
|
||||
}
|
||||
|
||||
fprintf( outputFile, "Z\" /> \n" );
|
||||
// If the cornerlist ends where it begins, then close the poly
|
||||
if( aCornerList.front() == aCornerList.back() )
|
||||
fprintf( outputFile, "Z\" /> \n" );
|
||||
else
|
||||
{
|
||||
pos = userToDeviceCoordinates( aCornerList.back() );
|
||||
fprintf( outputFile, "%g,%g\n\" /> \n", pos.x, pos.y );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -535,12 +558,51 @@ void SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
|
||||
void SVG_PLOTTER::PlotImage( const wxImage& aImage, const wxPoint& aPos,
|
||||
double aScaleFactor )
|
||||
{
|
||||
// in svg file we must insert a link to a png image file to plot an image
|
||||
// the image itself is not included in the svg file.
|
||||
// So we prefer skip the image, and just draw a rectangle,
|
||||
// like other plotters which do not support images
|
||||
wxSize pix_size( aImage.GetWidth(), aImage.GetHeight() );
|
||||
|
||||
// Requested size (in IUs)
|
||||
DPOINT drawsize( aScaleFactor * pix_size.x,
|
||||
aScaleFactor * pix_size.y );
|
||||
|
||||
// calculate the bitmap start position
|
||||
wxPoint start( aPos.x - drawsize.x / 2,
|
||||
aPos.y - drawsize.y / 2);
|
||||
|
||||
// Rectangles having a 0 size value for height or width are just not drawn on Inscape,
|
||||
// so use a line when happens.
|
||||
if( drawsize.x == 0.0 || drawsize.y == 0.0 ) // Draw a line
|
||||
{
|
||||
PLOTTER::PlotImage( aImage, aPos, aScaleFactor );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMemoryOutputStream img_stream;
|
||||
|
||||
aImage.SaveFile( img_stream, wxBITMAP_TYPE_PNG );
|
||||
size_t input_len = img_stream.GetOutputStreamBuffer()->GetBufferSize();
|
||||
std::vector<uint8_t> buffer( input_len );
|
||||
std::vector<uint8_t> encoded;
|
||||
|
||||
img_stream.CopyTo( buffer.data(), buffer.size() );
|
||||
base64::encode( buffer, encoded );
|
||||
|
||||
fprintf( outputFile,
|
||||
"<image x=\"%g\" y=\"%g\" xlink:href=\"data:image/png;base64,",
|
||||
userToDeviceSize( start.x ), userToDeviceSize( start.y )
|
||||
);
|
||||
|
||||
for( size_t i = 0; i < encoded.size(); i++ )
|
||||
{
|
||||
fprintf( outputFile, "%c", static_cast<char>( encoded[i] ) );
|
||||
|
||||
if( ( i % 64 ) == 63 )
|
||||
fprintf( outputFile, "\n" );
|
||||
}
|
||||
|
||||
fprintf( outputFile, "\"\npreserveAspectRatio=\"none\" width=\"%g\" height=\"%g\" />",
|
||||
userToDeviceSize( drawsize.x ), userToDeviceSize( drawsize.y ) );
|
||||
}
|
||||
|
||||
PLOTTER::PlotImage( aImage, aPos, aScaleFactor );
|
||||
|
||||
}
|
||||
|
||||
@@ -601,7 +663,11 @@ bool SVG_PLOTTER::StartPlot()
|
||||
"<?xml version=\"1.0\" standalone=\"no\"?>\n",
|
||||
" <!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \n",
|
||||
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"> \n",
|
||||
"<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" \n",
|
||||
"<svg\n"
|
||||
" xmlns:svg=\"http://www.w3.org/2000/svg\"\n"
|
||||
" xmlns=\"http://www.w3.org/2000/svg\"\n",
|
||||
" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n",
|
||||
" version=\"1.1\"\n",
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -614,7 +680,7 @@ bool SVG_PLOTTER::StartPlot()
|
||||
// Write viewport pos and size
|
||||
wxPoint origin; // TODO set to actual value
|
||||
fprintf( outputFile,
|
||||
" width=\"%gcm\" height=\"%gcm\" viewBox=\"%d %d %d %d \">\n",
|
||||
" width=\"%fcm\" height=\"%fcm\" viewBox=\"%d %d %d %d\">\n",
|
||||
(double) paperSize.x / m_IUsPerDecimil * 2.54 / 10000,
|
||||
(double) paperSize.y / m_IUsPerDecimil * 2.54 / 10000,
|
||||
origin.x, origin.y,
|
||||
@@ -641,7 +707,7 @@ bool SVG_PLOTTER::StartPlot()
|
||||
m_brush_rgb_color, opacity, m_pen_rgb_color, opacity );
|
||||
|
||||
// output the pen cap and line joint
|
||||
fputs( "stroke-linecap:round; stroke-linejoin:round; \"\n", outputFile );
|
||||
fputs( "stroke-linecap:round; stroke-linejoin:round;\"\n", outputFile );
|
||||
fputs( " transform=\"translate(0 0) scale(1 1)\">\n", outputFile );
|
||||
return true;
|
||||
}
|
||||
@@ -674,7 +740,71 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
|
||||
SetColor( aColor );
|
||||
SetCurrentLineWidth( aWidth );
|
||||
|
||||
// TODO: see if the postscript native text code can be used in SVG plotter
|
||||
int width = currentPenWidth;
|
||||
|
||||
if( aWidth <= 0 && aBold )
|
||||
width = GetPenSizeForBold( std::min( aSize.x, aSize.y ) );
|
||||
|
||||
if( aWidth <= 0 )
|
||||
width = currentPenWidth;
|
||||
|
||||
wxPoint text_pos = aPos;
|
||||
const char *hjust = "start";
|
||||
|
||||
switch( aH_justify )
|
||||
{
|
||||
case GR_TEXT_HJUSTIFY_CENTER:
|
||||
hjust = "middle";
|
||||
break;
|
||||
|
||||
case GR_TEXT_HJUSTIFY_RIGHT:
|
||||
hjust = "end";
|
||||
break;
|
||||
|
||||
case GR_TEXT_HJUSTIFY_LEFT:
|
||||
hjust = "start";
|
||||
break;
|
||||
}
|
||||
|
||||
switch( aV_justify )
|
||||
{
|
||||
case GR_TEXT_VJUSTIFY_CENTER:
|
||||
text_pos.y += aSize.y / 2;
|
||||
break;
|
||||
|
||||
case GR_TEXT_VJUSTIFY_TOP:
|
||||
text_pos.y += aSize.y;
|
||||
break;
|
||||
|
||||
case GR_TEXT_VJUSTIFY_BOTTOM:
|
||||
break;
|
||||
}
|
||||
|
||||
wxSize text_size;
|
||||
// aSize.x or aSize.y is < 0 for mirrored texts.
|
||||
// The actual text size value is the absolue value
|
||||
text_size.x = std::abs( GraphicTextWidth( aText, aSize, aItalic, width ) );
|
||||
text_size.y = std::abs( aSize.x * 4/3 ); // Hershey font height to em size conversion
|
||||
DPOINT anchor_pos_dev = userToDeviceCoordinates( aPos );
|
||||
DPOINT text_pos_dev = userToDeviceCoordinates( text_pos );
|
||||
DPOINT sz_dev = userToDeviceSize( text_size );
|
||||
|
||||
if( aOrient != 0 ) {
|
||||
fprintf( outputFile,
|
||||
"<g transform=\"rotate(%g %g %g)\">\n",
|
||||
- aOrient * 0.1, anchor_pos_dev.x, anchor_pos_dev.y );
|
||||
}
|
||||
|
||||
fprintf( outputFile,
|
||||
"<text x=\"%g\" y=\"%g\"\n"
|
||||
"textLength=\"%g\" font-size=\"%g\" lengthAdjust=\"spacingAndGlyphs\"\n"
|
||||
"text-anchor=\"%s\" opacity=\"0\">%s</text>\n",
|
||||
text_pos_dev.x, text_pos_dev.y,
|
||||
sz_dev.x, sz_dev.y,
|
||||
hjust, TO_UTF8( XmlEsc( aText ) ) );
|
||||
|
||||
if( aOrient != 0 )
|
||||
fputs( "</g>\n", outputFile );
|
||||
|
||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
||||
aWidth, aItalic, aBold, aMultilineAllowed );
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <vector>
|
||||
|
||||
#include <trigo.h>
|
||||
#include <eda_base_frame.h>
|
||||
@@ -164,7 +165,17 @@ void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int r
|
||||
/* Please NOTE the different sign due to Y-axis flip */
|
||||
start.x = centre.x + KiROUND( cosdecideg( radius, -StAngle ) );
|
||||
start.y = centre.y + KiROUND( sindecideg( radius, -StAngle ) );
|
||||
MoveTo( start );
|
||||
|
||||
if( fill != NO_FILL )
|
||||
{
|
||||
MoveTo( centre );
|
||||
LineTo( start );
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveTo( start );
|
||||
}
|
||||
|
||||
for( int ii = StAngle + delta; ii < EndAngle; ii += delta )
|
||||
{
|
||||
end.x = centre.x + KiROUND( cosdecideg( radius, -ii ) );
|
||||
@@ -174,7 +185,16 @@ void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int r
|
||||
|
||||
end.x = centre.x + KiROUND( cosdecideg( radius, -EndAngle ) );
|
||||
end.y = centre.y + KiROUND( sindecideg( radius, -EndAngle ) );
|
||||
FinishTo( end );
|
||||
|
||||
if( fill != NO_FILL )
|
||||
{
|
||||
LineTo( end );
|
||||
FinishTo( centre );
|
||||
}
|
||||
else
|
||||
{
|
||||
FinishTo( end );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -530,6 +550,9 @@ void PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill,
|
||||
for( int ii = 0; ii < aCornerList.PointCount(); ii++ )
|
||||
cornerList.push_back( wxPoint( aCornerList.CPoint( ii ) ) );
|
||||
|
||||
if( aCornerList.IsClosed() && cornerList.front() != cornerList.back() )
|
||||
cornerList.push_back( wxPoint( aCornerList.CPoint( 0 ) ) );
|
||||
|
||||
PlotPoly( cornerList , aFill, aWidth, aData );
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
#include <limits>
|
||||
|
||||
#include <preview_items/polygon_geom_manager.h>
|
||||
|
||||
@@ -67,6 +68,7 @@ bool POLYGON_GEOM_MANAGER::AddPoint( const VECTOR2I& aPt )
|
||||
|
||||
void POLYGON_GEOM_MANAGER::SetFinished()
|
||||
{
|
||||
|
||||
m_client.OnComplete( *this );
|
||||
}
|
||||
|
||||
@@ -95,9 +97,9 @@ bool POLYGON_GEOM_MANAGER::IsSelfIntersecting( bool aIncludeLeaderPts ) const
|
||||
}
|
||||
|
||||
|
||||
void POLYGON_GEOM_MANAGER::SetCursorPosition( const VECTOR2I& aPos, LEADER_MODE aModifier )
|
||||
void POLYGON_GEOM_MANAGER::SetCursorPosition( const VECTOR2I& aPos )
|
||||
{
|
||||
updateLeaderPoints( aPos, aModifier );
|
||||
updateLeaderPoints( aPos );
|
||||
}
|
||||
|
||||
|
||||
@@ -143,17 +145,58 @@ void POLYGON_GEOM_MANAGER::Reset()
|
||||
void POLYGON_GEOM_MANAGER::updateLeaderPoints( const VECTOR2I& aEndPoint, LEADER_MODE aModifier )
|
||||
{
|
||||
wxCHECK( m_lockedPoints.PointCount() > 0, /*void*/ );
|
||||
const VECTOR2I& lastPt = m_lockedPoints.CLastPoint();
|
||||
auto newEnd = VECTOR2I( aEndPoint );
|
||||
const VECTOR2I& last_pt = m_lockedPoints.CLastPoint();
|
||||
|
||||
if( m_leaderMode == LEADER_MODE::DEG45 || aModifier == LEADER_MODE::DEG45 )
|
||||
{
|
||||
const VECTOR2I lineVector( aEndPoint - lastPt );
|
||||
const VECTOR2I line_vec( aEndPoint - last_pt );
|
||||
// get a restricted 45/H/V line from the last fixed point to the cursor
|
||||
newEnd = lastPt + GetVectorSnapped45( lineVector );
|
||||
auto new_end = last_pt + GetVectorSnapped45( line_vec );
|
||||
OPT_VECTOR2I pt;
|
||||
|
||||
if( m_lockedPoints.SegmentCount() > 1 )
|
||||
{
|
||||
const VECTOR2I& start_pt = m_lockedPoints.CPoint( 0 );
|
||||
VECTOR2I completed_vec( start_pt - new_end );
|
||||
|
||||
if( completed_vec != GetVectorSnapped45( completed_vec ) )
|
||||
{
|
||||
SEG v_first( new_end, VECTOR2I( new_end.x, start_pt.y ) );
|
||||
SEG h_first( new_end, VECTOR2I( start_pt.x, new_end.y ) );
|
||||
|
||||
SHAPE_LINE_CHAIN::INTERSECTIONS intersections;
|
||||
auto v_hits = m_lockedPoints.Intersect( v_first, intersections );
|
||||
v_hits += m_lockedPoints.Intersect( SEG( v_first.B, start_pt ), intersections );
|
||||
pt = v_first.B;
|
||||
|
||||
if( v_hits > 0 )
|
||||
{
|
||||
intersections.clear();
|
||||
auto h_hits = m_lockedPoints.Intersect( h_first, intersections );
|
||||
h_hits += m_lockedPoints.Intersect( SEG( h_first.B, start_pt ), intersections );
|
||||
|
||||
if( h_hits < v_hits )
|
||||
pt = h_first.B;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_leaderPts = SHAPE_LINE_CHAIN( last_pt, new_end );
|
||||
|
||||
if( pt )
|
||||
{
|
||||
// This checks for backtracking from the point to intersection
|
||||
if( SEG( last_pt, new_end ).Collinear( SEG( new_end, *pt ) ) )
|
||||
m_leaderPts = SHAPE_LINE_CHAIN( last_pt, *pt );
|
||||
else
|
||||
m_leaderPts.Append( *pt );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// direct segment
|
||||
m_leaderPts = SHAPE_LINE_CHAIN( last_pt, aEndPoint );
|
||||
}
|
||||
|
||||
// direct segment
|
||||
m_leaderPts = SHAPE_LINE_CHAIN( lastPt, newEnd );
|
||||
m_client.OnGeometryChange( *this );
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
using namespace KIGFX::PREVIEW;
|
||||
|
||||
const double POLYGON_ITEM::POLY_LINE_WIDTH = 150000.0;
|
||||
|
||||
POLYGON_ITEM::POLYGON_ITEM():
|
||||
SIMPLE_OVERLAY_ITEM()
|
||||
@@ -60,12 +61,14 @@ void POLYGON_ITEM::drawPreviewShape( KIGFX::VIEW* aView ) const
|
||||
auto& gal = *aView->GetGAL();
|
||||
auto rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( aView->GetPainter()->GetSettings() );
|
||||
|
||||
gal.SetLineWidth( POLY_LINE_WIDTH );
|
||||
gal.DrawPolyline( m_lockedChain );
|
||||
gal.DrawPolygon( m_polyfill );
|
||||
|
||||
// draw the leader line in a different color
|
||||
gal.SetStrokeColor( rs->GetLayerColor( LAYER_AUX_ITEMS ) );
|
||||
gal.DrawPolyline( m_leaderChain );
|
||||
|
||||
gal.DrawPolygon( m_polyfill );
|
||||
}
|
||||
|
||||
|
||||
|
||||
+5
-1
@@ -209,8 +209,12 @@ int ReadDelimitedText( char* aDest, const char* aSource, int aDestSize )
|
||||
}
|
||||
|
||||
|
||||
std::string EscapedUTF8( const wxString& aString )
|
||||
std::string EscapedUTF8( wxString aString )
|
||||
{
|
||||
// No new-lines allowed in quoted strings
|
||||
aString.Replace( "\r\n", "\r" );
|
||||
aString.Replace( "\n", "\r" );
|
||||
|
||||
std::string utf8 = TO_UTF8( aString );
|
||||
|
||||
std::string ret;
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
%include <std_map.i>
|
||||
%include <std_shared_ptr.i>
|
||||
%include <std_set.i>
|
||||
%include <stdint.i>
|
||||
|
||||
%include "ki_exception.i" // affects all that follow it
|
||||
|
||||
@@ -95,6 +96,7 @@ principle should be easily implemented by adapting the current STL containers.
|
||||
#include <marker_base.h>
|
||||
#include <eda_text.h>
|
||||
#include <convert_to_biu.h>
|
||||
#include <build_version.h>
|
||||
%}
|
||||
|
||||
// all the wx wrappers for wxString, wxPoint, wxRect, wxChar ..
|
||||
@@ -115,6 +117,7 @@ principle should be easily implemented by adapting the current STL containers.
|
||||
%include colors_design_settings.h
|
||||
%include marker_base.h
|
||||
%include eda_text.h
|
||||
%include build_version.h
|
||||
|
||||
// Cast time_t to known type for Python
|
||||
typedef long time_t;
|
||||
|
||||
@@ -1040,36 +1040,36 @@ __asm (
|
||||
# endif
|
||||
#endif
|
||||
" # reserve space on stack\n"
|
||||
" subi %r1, %r1, 328\n"
|
||||
" subi %r1, %r1, 320\n"
|
||||
#if _CALL_ELF != 2
|
||||
" std %r2, 152(%r1) # save TOC\n"
|
||||
" std %r2, 144(%r1) # save TOC\n"
|
||||
#endif
|
||||
" std %r14, 160(%r1) # save R14\n"
|
||||
" std %r15, 168(%r1) # save R15\n"
|
||||
" std %r16, 176(%r1) # save R16\n"
|
||||
" std %r17, 184(%r1) # save R17\n"
|
||||
" std %r18, 192(%r1) # save R18\n"
|
||||
" std %r19, 200(%r1) # save R19\n"
|
||||
" std %r20, 208(%r1) # save R20\n"
|
||||
" std %r21, 216(%r1) # save R21\n"
|
||||
" std %r22, 224(%r1) # save R22\n"
|
||||
" std %r23, 232(%r1) # save R23\n"
|
||||
" std %r24, 240(%r1) # save R24\n"
|
||||
" std %r25, 248(%r1) # save R25\n"
|
||||
" std %r26, 256(%r1) # save R26\n"
|
||||
" std %r27, 264(%r1) # save R27\n"
|
||||
" std %r28, 272(%r1) # save R28\n"
|
||||
" std %r29, 280(%r1) # save R29\n"
|
||||
" std %r30, 288(%r1) # save R30\n"
|
||||
" std %r31, 296(%r1) # save R31\n"
|
||||
" std %r14, 152(%r1) # save R14\n"
|
||||
" std %r15, 160(%r1) # save R15\n"
|
||||
" std %r16, 168(%r1) # save R16\n"
|
||||
" std %r17, 176(%r1) # save R17\n"
|
||||
" std %r18, 184(%r1) # save R18\n"
|
||||
" std %r19, 192(%r1) # save R19\n"
|
||||
" std %r20, 200(%r1) # save R20\n"
|
||||
" std %r21, 208(%r1) # save R21\n"
|
||||
" std %r22, 216(%r1) # save R22\n"
|
||||
" std %r23, 224(%r1) # save R23\n"
|
||||
" std %r24, 232(%r1) # save R24\n"
|
||||
" std %r25, 240(%r1) # save R25\n"
|
||||
" std %r26, 248(%r1) # save R26\n"
|
||||
" std %r27, 256(%r1) # save R27\n"
|
||||
" std %r28, 264(%r1) # save R28\n"
|
||||
" std %r29, 272(%r1) # save R29\n"
|
||||
" std %r30, 280(%r1) # save R30\n"
|
||||
" std %r31, 288(%r1) # save R31\n"
|
||||
" # save CR\n"
|
||||
" mfcr %r0\n"
|
||||
" std %r0, 304(%r1)\n"
|
||||
" std %r0, 296(%r1)\n"
|
||||
" # save LR\n"
|
||||
" mflr %r0\n"
|
||||
" std %r0, 312(%r1)\n"
|
||||
" std %r0, 304(%r1)\n"
|
||||
" # save LR as PC\n"
|
||||
" std %r0, 320(%r1)\n"
|
||||
" std %r0, 312(%r1)\n"
|
||||
" # test if fpu env should be preserved\n"
|
||||
" cmpwi cr7, %r6, 0\n"
|
||||
" beq cr7, 1f\n"
|
||||
@@ -1091,8 +1091,6 @@ __asm (
|
||||
" stfd %f29, 120(%r1) # save F29\n"
|
||||
" stfd %f30, 128(%r1) # save F30\n"
|
||||
" stfd %f31, 136(%r1) # save F31\n"
|
||||
" mffs %f0 # load FPSCR\n"
|
||||
" stfd %f0, 144(%r1) # save FPSCR\n"
|
||||
"1:\n"
|
||||
" # store RSP (pointing to context-data) in R3\n"
|
||||
" std %r1, 0(%r3)\n"
|
||||
@@ -1119,42 +1117,40 @@ __asm (
|
||||
" lfd %f29, 120(%r1) # restore F29\n"
|
||||
" lfd %f30, 128(%r1) # restore F30\n"
|
||||
" lfd %f31, 136(%r1) # restore F31\n"
|
||||
" lfd %f0, 144(%r1) # load FPSCR\n"
|
||||
" mtfsf 0xff, %f0 # restore FPSCR\n"
|
||||
"2:\n"
|
||||
#if _CALL_ELF != 2
|
||||
" ld %r2, 152(%r1) # restore TOC\n"
|
||||
" ld %r2, 144(%r1) # restore TOC\n"
|
||||
#endif
|
||||
" ld %r14, 160(%r1) # restore R14\n"
|
||||
" ld %r15, 168(%r1) # restore R15\n"
|
||||
" ld %r16, 176(%r1) # restore R16\n"
|
||||
" ld %r17, 184(%r1) # restore R17\n"
|
||||
" ld %r18, 192(%r1) # restore R18\n"
|
||||
" ld %r19, 200(%r1) # restore R19\n"
|
||||
" ld %r20, 208(%r1) # restore R20\n"
|
||||
" ld %r21, 216(%r1) # restore R21\n"
|
||||
" ld %r22, 224(%r1) # restore R22\n"
|
||||
" ld %r23, 232(%r1) # restore R23\n"
|
||||
" ld %r24, 240(%r1) # restore R24\n"
|
||||
" ld %r25, 248(%r1) # restore R25\n"
|
||||
" ld %r26, 256(%r1) # restore R26\n"
|
||||
" ld %r27, 264(%r1) # restore R27\n"
|
||||
" ld %r28, 272(%r1) # restore R28\n"
|
||||
" ld %r29, 280(%r1) # restore R29\n"
|
||||
" ld %r30, 288(%r1) # restore R30\n"
|
||||
" ld %r31, 296(%r1) # restore R31\n"
|
||||
" ld %r14, 152(%r1) # restore R14\n"
|
||||
" ld %r15, 160(%r1) # restore R15\n"
|
||||
" ld %r16, 168(%r1) # restore R16\n"
|
||||
" ld %r17, 176(%r1) # restore R17\n"
|
||||
" ld %r18, 184(%r1) # restore R18\n"
|
||||
" ld %r19, 192(%r1) # restore R19\n"
|
||||
" ld %r20, 200(%r1) # restore R20\n"
|
||||
" ld %r21, 208(%r1) # restore R21\n"
|
||||
" ld %r22, 216(%r1) # restore R22\n"
|
||||
" ld %r23, 224(%r1) # restore R23\n"
|
||||
" ld %r24, 232(%r1) # restore R24\n"
|
||||
" ld %r25, 240(%r1) # restore R25\n"
|
||||
" ld %r26, 248(%r1) # restore R26\n"
|
||||
" ld %r27, 256(%r1) # restore R27\n"
|
||||
" ld %r28, 264(%r1) # restore R28\n"
|
||||
" ld %r29, 272(%r1) # restore R29\n"
|
||||
" ld %r30, 280(%r1) # restore R30\n"
|
||||
" ld %r31, 288(%r1) # restore R31\n"
|
||||
" # restore CR\n"
|
||||
" ld %r0, 304(%r1)\n"
|
||||
" ld %r0, 296(%r1)\n"
|
||||
" mtcr %r0\n"
|
||||
" # restore LR\n"
|
||||
" ld %r0, 312(%r1)\n"
|
||||
" ld %r0, 304(%r1)\n"
|
||||
" mtlr %r0\n"
|
||||
" # load PC\n"
|
||||
" ld %r12, 320(%r1)\n"
|
||||
" ld %r12, 312(%r1)\n"
|
||||
" # restore CTR\n"
|
||||
" mtctr %r12\n"
|
||||
" # adjust stack\n"
|
||||
" addi %r1, %r1, 328\n"
|
||||
" addi %r1, %r1, 320\n"
|
||||
" # use third arg as return value after jump\n"
|
||||
" # use third arg as first arg in context function\n"
|
||||
" mr %r3, %r5\n"
|
||||
@@ -1212,19 +1208,19 @@ __asm (
|
||||
" clrrdi %r3, %r3, 4\n"
|
||||
" # reserve space for context-data on context-stack\n"
|
||||
" # including 64 byte of linkage + parameter area (R1 % 16 == 0)\n"
|
||||
" subi %r3, %r3, 392\n"
|
||||
" subi %r3, %r3, 384\n"
|
||||
" # third arg of make_fcontext() == address of context-function\n"
|
||||
" # entry point (ELFv2) or descriptor (ELFv1)\n"
|
||||
#if _CALL_ELF == 2
|
||||
" # save address of context-function entry point\n"
|
||||
" std %r5, 320(%r3)\n"
|
||||
" std %r5, 312(%r3)\n"
|
||||
#else
|
||||
" # save address of context-function entry point\n"
|
||||
" ld %r4, 0(%r5)\n"
|
||||
" std %r4, 320(%r3)\n"
|
||||
" std %r4, 312(%r3)\n"
|
||||
" # save TOC of context-function\n"
|
||||
" ld %r4, 8(%r5)\n"
|
||||
" std %r4, 152(%r3)\n"
|
||||
" std %r4, 144(%r3)\n"
|
||||
#endif
|
||||
" # load LR\n"
|
||||
" mflr %r0\n"
|
||||
@@ -1239,7 +1235,7 @@ __asm (
|
||||
" mtlr %r0\n"
|
||||
" # save address of finish as return-address for context-function\n"
|
||||
" # will be entered after context-function returns\n"
|
||||
" std %r4, 312(%r3)\n"
|
||||
" std %r4, 304(%r3)\n"
|
||||
" # restore return address from R6\n"
|
||||
" mtlr %r6\n"
|
||||
" blr # return pointer to context-data\n"
|
||||
|
||||
@@ -1526,7 +1526,7 @@ bool VIEW::IsVisible( const VIEW_ITEM* aItem ) const
|
||||
{
|
||||
const auto viewData = aItem->viewPrivData();
|
||||
|
||||
return viewData->m_flags & VISIBLE;
|
||||
return viewData && ( viewData->m_flags & VISIBLE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -326,10 +326,8 @@ void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent )
|
||||
return;
|
||||
}
|
||||
|
||||
#if wxCHECK_VERSION( 3, 0, 0 )
|
||||
if( !m_parentPanel->HasFocus() )
|
||||
break;
|
||||
#endif
|
||||
|
||||
double borderSize = std::min( m_settings.m_autoPanMargin * m_view->GetScreenPixelSize().x,
|
||||
m_settings.m_autoPanMargin * m_view->GetScreenPixelSize().y );
|
||||
@@ -626,16 +624,9 @@ void WX_VIEW_CONTROLS::refreshMouse()
|
||||
moveEvent.SetY( msp.y );
|
||||
|
||||
// Set the modifiers state
|
||||
#if wxCHECK_VERSION( 3, 0, 0 )
|
||||
moveEvent.SetControlDown( wxGetKeyState( WXK_CONTROL ) );
|
||||
moveEvent.SetShiftDown( wxGetKeyState( WXK_SHIFT ) );
|
||||
moveEvent.SetAltDown( wxGetKeyState( WXK_ALT ) );
|
||||
#else
|
||||
// wx <3.0 do not have accessors, but the fields are exposed
|
||||
moveEvent.m_controlDown = wxGetKeyState( WXK_CONTROL );
|
||||
moveEvent.m_shiftDown = wxGetKeyState( WXK_SHIFT );
|
||||
moveEvent.m_altDown = wxGetKeyState( WXK_ALT );
|
||||
#endif
|
||||
|
||||
m_cursorPos = m_view->ToWorld( VECTOR2D( msp.x, msp.y ) );
|
||||
wxPostEvent( m_parentPanel, moveEvent );
|
||||
@@ -660,30 +651,28 @@ void WX_VIEW_CONTROLS::UpdateScrollbars()
|
||||
VECTOR2I newScroll( ( viewport.Centre().x - boundary.GetLeft() ) * m_scrollScale.x,
|
||||
( viewport.Centre().y - boundary.GetTop() ) * m_scrollScale.y );
|
||||
|
||||
// We add the width of the scroll bar thumb to the range because the scroll range is given by
|
||||
// the full bar while the position is given by the left/top position of the thumb
|
||||
VECTOR2I newRange( m_scrollScale.x * boundary.GetWidth() + m_parentPanel->GetScrollThumb( wxSB_HORIZONTAL ),
|
||||
m_scrollScale.y * boundary.GetHeight() + m_parentPanel->GetScrollThumb( wxSB_VERTICAL ) );
|
||||
|
||||
// Flip scroll direction in flipped view
|
||||
if( m_view->IsMirroredX() )
|
||||
newScroll.x = ( boundary.GetRight() - viewport.Centre().x ) * m_scrollScale.x;
|
||||
|
||||
// Adjust scrollbars only if it is needed. Otherwise there are cases when canvas is continuosly
|
||||
// Adjust scrollbars only if it is needed. Otherwise there are cases when canvas is continuously
|
||||
// refreshed (Windows)
|
||||
if( m_scrollPos != newScroll )
|
||||
if( m_scrollPos != newScroll || newRange.x != m_parentPanel->GetScrollRange( wxSB_HORIZONTAL )
|
||||
|| newRange.y != m_parentPanel->GetScrollRange( wxSB_VERTICAL ) )
|
||||
{
|
||||
// Another example of wxWidgets being broken by design: scroll position is determined by the
|
||||
// left (or top, if vertical) edge of the slider. Fortunately, slider size seems to be constant
|
||||
// (at least for wxGTK and wxMSW), so we have to add its size to allow user to scroll the workspace
|
||||
// till the end.
|
||||
|
||||
m_parentPanel->SetScrollbars( 1, 1,
|
||||
#if defined(__LINUX__)
|
||||
m_scrollScale.x * boundary.GetWidth() + 1623, m_scrollScale.y * boundary.GetHeight() + 1623,
|
||||
#elif defined(__WIN32__) || defined(__WIN64__)
|
||||
m_scrollScale.x * boundary.GetWidth() + 1377, m_scrollScale.y * boundary.GetHeight() + 741,
|
||||
#else
|
||||
m_scrollScale.x * boundary.GetWidth(), m_scrollScale.y * boundary.GetHeight(),
|
||||
#endif
|
||||
newScroll.x, newScroll.y, false );
|
||||
|
||||
m_parentPanel->SetScrollbars( 1, 1, newRange.x, newRange.y, newScroll.x, newScroll.y, true );
|
||||
m_scrollPos = newScroll;
|
||||
|
||||
#ifndef __APPLE__
|
||||
// Trigger a mouse refresh to get the canvas update in GTK (re-draws the scrollbars).
|
||||
// Note that this causes an infinite loop on OSX as it generates a paint event.
|
||||
refreshMouse();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -715,8 +715,11 @@ void mpFXY::Plot( wxDC& dc, mpWindow& w )
|
||||
continue;
|
||||
}
|
||||
|
||||
if( x0 == x1 ) // continue until a new X coordinate is reached
|
||||
continue;
|
||||
// This gives disastrous results with very high-frequency plots where the
|
||||
// X coordinate may not increment until several waves later
|
||||
//
|
||||
// if( x0 == x1 ) // continue until a new X coordinate is reached
|
||||
// continue;
|
||||
|
||||
bool outDown = ( y0 > maxYpx ) && ( y1 > maxYpx );
|
||||
bool outUp = ( y0 < minYpx ) && ( y1 < minYpx );
|
||||
@@ -2168,9 +2171,11 @@ void mpWindow::AdjustLimitedView()
|
||||
if( !m_enableLimitedView )
|
||||
return;
|
||||
|
||||
// m_min and m_max are plot limits for curves
|
||||
// xMin, xMax, yMin, yMax are the full limits (plot limit + margin)
|
||||
const double xMin = m_minX - m_marginLeft / m_scaleX;
|
||||
const double xMax = m_maxX - m_marginRight / m_scaleX;
|
||||
const double yMin = m_minY + m_marginTop / m_scaleY;
|
||||
const double xMax = m_maxX + m_marginRight / m_scaleX;
|
||||
const double yMin = m_minY - m_marginTop / m_scaleY;
|
||||
const double yMax = m_maxY + m_marginBottom / m_scaleY;
|
||||
|
||||
if( m_desiredXmin < xMin )
|
||||
|
||||
@@ -114,7 +114,6 @@ WX_PROGRESS_REPORTER::WX_PROGRESS_REPORTER( wxWindow* aParent, const wxString& a
|
||||
|
||||
WX_PROGRESS_REPORTER::~WX_PROGRESS_REPORTER()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/textentry.h>
|
||||
#include <limits>
|
||||
@@ -46,6 +47,8 @@ UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent,
|
||||
m_useMils = aUseMils;
|
||||
m_allowEval = allowEval && dynamic_cast<wxTextEntry*>( m_value );
|
||||
m_needsEval = false;
|
||||
m_selStart = 0;
|
||||
m_selEnd = 0;
|
||||
|
||||
auto textEntry = dynamic_cast<wxTextEntry*>( m_value );
|
||||
if( textEntry )
|
||||
@@ -79,7 +82,10 @@ void UNIT_BINDER::onSetFocus( wxFocusEvent& aEvent )
|
||||
wxString oldStr = m_eval.OriginalText();
|
||||
|
||||
if( oldStr.length() )
|
||||
{
|
||||
textEntry->SetValue( oldStr );
|
||||
textEntry->SetSelection( m_selStart, m_selEnd );
|
||||
}
|
||||
|
||||
m_needsEval = true;
|
||||
}
|
||||
@@ -95,8 +101,25 @@ void UNIT_BINDER::onKillFocus( wxFocusEvent& aEvent )
|
||||
if( m_allowEval && textEntry )
|
||||
{
|
||||
if( m_eval.Process( textEntry->GetValue() ) )
|
||||
{
|
||||
textEntry->GetSelection( &m_selStart, &m_selEnd );
|
||||
wxString sel = textEntry->GetStringSelection();
|
||||
|
||||
textEntry->ChangeValue( m_eval.Result() );
|
||||
|
||||
#ifdef __WXGTK__
|
||||
// Manually copy the selected text to the primary selection clipboard
|
||||
if( wxTheClipboard->Open() )
|
||||
{
|
||||
bool clipTarget = wxTheClipboard->IsUsingPrimarySelection();
|
||||
wxTheClipboard->UsePrimarySelection( true );
|
||||
wxTheClipboard->SetData( new wxTextDataObject( sel ) );
|
||||
wxTheClipboard->UsePrimarySelection( clipTarget );
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
m_needsEval = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -599,12 +599,10 @@ void WIDGET_HOTKEY_LIST::initializeElements()
|
||||
|
||||
// Add the bitmap image for invalid hotkey warning
|
||||
// bitmap size is not know (depending on it is built). So get it:
|
||||
wxSize iconsize;
|
||||
wxBitmap bm_invalid = KiBitmap( cancel_xpm );
|
||||
iconsize.x = bm_invalid.GetWidth();
|
||||
iconsize.y = bm_invalid.GetHeight();
|
||||
m_imgList = new wxImageList( iconsize.x, iconsize.y, true, 1);
|
||||
m_imgList->Add( bm_invalid );
|
||||
wxIcon icon;
|
||||
icon.CopyFromBitmap( KiBitmap( cancel_xpm ) );
|
||||
m_imgList = new wxImageList( icon.GetSize().x, icon.GetSize().y, true, 1 );
|
||||
m_imgList->Add( icon );
|
||||
AssignImageList( m_imgList );
|
||||
|
||||
if( !m_readOnly )
|
||||
|
||||
@@ -148,7 +148,12 @@ void WX_GRID::DrawColLabel( wxDC& dc, int col )
|
||||
|
||||
// It is reported that we need to erase the background to avoid display
|
||||
// artefacts, see #12055.
|
||||
// wxWidgets renamed this variable between 3.1.2 and 3.1.3 ...
|
||||
#if wxCHECK_VERSION( 3, 1, 3 )
|
||||
wxDCBrushChanger setBrush( dc, m_colLabelWin->GetBackgroundColour() );
|
||||
#else
|
||||
wxDCBrushChanger setBrush( dc, m_colWindow->GetBackgroundColour() );
|
||||
#endif
|
||||
dc.DrawRectangle(rect);
|
||||
|
||||
rend.DrawBorder( *this, dc, rect );
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2019 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
|
||||
@@ -27,9 +27,34 @@
|
||||
* @file wildcards_and_files_ext.cpp
|
||||
* Definition of file extensions used in Kicad.
|
||||
*/
|
||||
#include <regex>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
|
||||
bool compareFileExtensions( const std::string& aExtension,
|
||||
const std::vector<std::string>& aReference, bool aCaseSensitive )
|
||||
{
|
||||
// Form the regular expression string by placing all possible extensions into it as alternatives
|
||||
std::string regexString = "(";
|
||||
bool first = true;
|
||||
for( auto ext : aReference )
|
||||
{
|
||||
// The | separate goes between the extensions
|
||||
if( !first )
|
||||
regexString += "|";
|
||||
else
|
||||
first = false;
|
||||
|
||||
regexString += ext;
|
||||
}
|
||||
regexString += ")";
|
||||
|
||||
// Create the regex and see if it matches
|
||||
std::regex extRegex( regexString, aCaseSensitive ? std::regex::ECMAScript : std::regex::icase );
|
||||
return std::regex_match( aExtension, extRegex );
|
||||
}
|
||||
|
||||
|
||||
wxString formatWildcardExt( const wxString& aWildcard )
|
||||
{
|
||||
wxString wc;
|
||||
@@ -91,7 +116,6 @@ wxString AddFileExtListToFilter( const std::vector<std::string>& aExts )
|
||||
|
||||
const std::string SchematicSymbolFileExtension( "sym" );
|
||||
const std::string SchematicLibraryFileExtension( "lib" );
|
||||
const std::string SchematicBackupFileExtension( "bak" );
|
||||
|
||||
const std::string VrmlFileExtension( "wrl" );
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>cvpcb_doc.icns</string>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>net</string>
|
||||
<string>cmp</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>cvpcb document</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Owner</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>cvpcb</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string></string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>cvpcb.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.kicad-pcb.cvpcb</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>@KICAD_VERSION_FULL@</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>CvPcb</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@KICAD_VERSION@</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@KICAD_VERSION_FULL@</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>LSRequiresCarbon</key>
|
||||
<true/>
|
||||
<key>NSRequiresAquaSystemAppearance</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string></string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>True</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -140,7 +140,7 @@ static int guessNickname( FP_LIB_TABLE* aTbl, LIB_ID* aFootprintId )
|
||||
{
|
||||
wxArrayString fpnames;
|
||||
|
||||
aTbl->FootprintEnumerate( fpnames, nicks[libNdx] );
|
||||
aTbl->FootprintEnumerate( fpnames, nicks[libNdx], true );
|
||||
|
||||
for( unsigned nameNdx = 0; nameNdx<fpnames.size(); ++nameNdx )
|
||||
{
|
||||
|
||||
@@ -79,7 +79,7 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
|
||||
KiScaledBitmap( module_filtered_list_xpm, this ),
|
||||
wxNullBitmap,
|
||||
true, NULL,
|
||||
_( "Filter footprint list by schematic symbol keywords" ),
|
||||
_( "Use schematic symbol footprint filters" ),
|
||||
wxEmptyString );
|
||||
|
||||
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
|
||||
|
||||
@@ -394,11 +394,8 @@ endif()
|
||||
|
||||
# these 2 binaries are a matched set, keep them together:
|
||||
if( APPLE )
|
||||
include( ${CMAKE_MODULE_PATH}/KiCadVersion.cmake )
|
||||
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist @ONLY )
|
||||
|
||||
set_target_properties( eeschema PROPERTIES
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
|
||||
MACOSX_BUNDLE_INFO_PLIST ${PROJECT_BINARY_DIR}/eeschema/Info.plist
|
||||
)
|
||||
|
||||
# puts binaries into the *.app bundle while linking
|
||||
|
||||
+34
-17
@@ -38,7 +38,7 @@
|
||||
#include <class_library.h>
|
||||
|
||||
|
||||
void mapExistingAnnotation( std::map<timestamp_t, wxString>& aMap )
|
||||
void mapExistingAnnotation( std::map<wxString, wxString>& aMap )
|
||||
{
|
||||
SCH_SHEET_LIST sheets( g_RootSheet );
|
||||
SCH_REFERENCE_LIST references;
|
||||
@@ -48,10 +48,19 @@ void mapExistingAnnotation( std::map<timestamp_t, wxString>& aMap )
|
||||
for( size_t i = 0; i < references.GetCount(); i++ )
|
||||
{
|
||||
SCH_COMPONENT* comp = references[ i ].GetComp();
|
||||
wxString ref = comp->GetField( REFERENCE )->GetFullyQualifiedText();
|
||||
|
||||
const SCH_SHEET_PATH* curr_sheetpath = &references[ i ].GetSheetPath();
|
||||
wxString full_path = curr_sheetpath->Path();
|
||||
full_path += wxString::Format( wxT( "/%8.8lX" ),
|
||||
(unsigned long) comp->GetTimeStamp() );
|
||||
|
||||
wxString ref = comp->GetRef( (SCH_SHEET_PATH*)curr_sheetpath );
|
||||
|
||||
if( comp->GetUnitCount() > 1 )
|
||||
ref << LIB_PART::SubReference( comp->GetUnitSelection( curr_sheetpath ) );
|
||||
|
||||
if( !ref.Contains( wxT( "?" ) ) )
|
||||
aMap[ comp->GetTimeStamp() ] = ref;
|
||||
aMap[ full_path ] = ref;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +108,7 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
|
||||
SCH_MULTI_UNIT_REFERENCE_MAP lockedComponents;
|
||||
|
||||
// Map of previous annotation for building info messages
|
||||
std::map<timestamp_t, wxString> previousAnnotation;
|
||||
std::map<wxString, wxString> previousAnnotation;
|
||||
|
||||
// Test for and replace duplicate time stamps in components and sheets. Duplicate
|
||||
// time stamps can happen with old schematics, schematic conversions, or manual
|
||||
@@ -191,9 +200,19 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
|
||||
for( size_t i = 0; i < references.GetCount(); i++ )
|
||||
{
|
||||
SCH_COMPONENT* comp = references[ i ].GetComp();
|
||||
wxString prevRef = previousAnnotation[ comp->GetTimeStamp() ];
|
||||
wxString newRef = comp->GetField( REFERENCE )->GetFullyQualifiedText();
|
||||
wxString msg;
|
||||
|
||||
const SCH_SHEET_PATH* curr_sheetpath = &references[ i ].GetSheetPath();
|
||||
wxString curr_full_path = curr_sheetpath->Path();
|
||||
curr_full_path += wxString::Format( wxT( "/%8.8lX" ),
|
||||
(unsigned long) comp->GetTimeStamp() );
|
||||
|
||||
wxString prevRef = previousAnnotation[ curr_full_path ];
|
||||
wxString newRef = comp->GetRef( curr_sheetpath );
|
||||
|
||||
if( comp->GetUnitCount() > 1 )
|
||||
newRef << LIB_PART::SubReference( comp->GetUnitSelection( curr_sheetpath ) );
|
||||
|
||||
wxString msg;
|
||||
|
||||
if( prevRef.Length() )
|
||||
{
|
||||
@@ -202,27 +221,25 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
|
||||
|
||||
if( comp->GetUnitCount() > 1 )
|
||||
msg.Printf( _( "Updated %s (unit %s) from %s to %s" ),
|
||||
GetChars( comp->GetField( VALUE )->GetShownText() ),
|
||||
comp->GetField( VALUE )->GetShownText(),
|
||||
LIB_PART::SubReference( comp->GetUnit(), false ),
|
||||
GetChars( prevRef ),
|
||||
GetChars( newRef ) );
|
||||
prevRef, newRef );
|
||||
else
|
||||
msg.Printf( _( "Updated %s from %s to %s" ),
|
||||
GetChars( comp->GetField( VALUE )->GetShownText() ),
|
||||
GetChars( prevRef ),
|
||||
GetChars( newRef ) );
|
||||
comp->GetField( VALUE )->GetShownText(),
|
||||
prevRef, newRef );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( comp->GetUnitCount() > 1 )
|
||||
msg.Printf( _( "Annotated %s (unit %s) as %s" ),
|
||||
GetChars( comp->GetField( VALUE )->GetShownText() ),
|
||||
comp->GetField( VALUE )->GetShownText(),
|
||||
LIB_PART::SubReference( comp->GetUnit(), false ),
|
||||
GetChars( newRef ) );
|
||||
newRef );
|
||||
else
|
||||
msg.Printf( _( "Annotated %s as %s" ),
|
||||
GetChars( comp->GetField( VALUE )->GetShownText() ),
|
||||
GetChars( newRef ) );
|
||||
comp->GetField( VALUE )->GetShownText(),
|
||||
newRef );
|
||||
}
|
||||
|
||||
aReporter.Report( msg, REPORTER::RPT_ACTION );
|
||||
|
||||
+6
-1
@@ -63,9 +63,14 @@ int SCH_EDIT_FRAME::BlockCommand( EDA_KEY key )
|
||||
switch( key )
|
||||
{
|
||||
default:
|
||||
cmd = key & 0xFF;
|
||||
cmd = key & 0xFFFF;
|
||||
|
||||
if( cmd == 0 ) // All not handled values are seen as block move
|
||||
cmd = BLOCK_MOVE;
|
||||
|
||||
break;
|
||||
|
||||
case GR_KB_ALT: // Should be BLOCK_ROTATE. Not suported: fall into move
|
||||
case 0:
|
||||
cmd = BLOCK_MOVE;
|
||||
break;
|
||||
|
||||
@@ -745,7 +745,6 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
|
||||
{
|
||||
aItem->SetFlags( STRUCT_DELETED );
|
||||
itemList.PushItem( ITEM_PICKER( aItem, UR_DELETED ) );
|
||||
RemoveFromScreen( aItem );
|
||||
};
|
||||
|
||||
remove_item( aJunction );
|
||||
|
||||
+16
-51
@@ -64,9 +64,7 @@ int LIB_PART::m_subpartFirstId = 'A';
|
||||
|
||||
LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_PART* aRootPart ) :
|
||||
EDA_ITEM( LIB_ALIAS_T ),
|
||||
shared( aRootPart ),
|
||||
tmpUnit( 0 ),
|
||||
tmpConversion( 0 )
|
||||
shared( aRootPart )
|
||||
{
|
||||
SetName( aName );
|
||||
}
|
||||
@@ -74,9 +72,7 @@ LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_PART* aRootPart ) :
|
||||
|
||||
LIB_ALIAS::LIB_ALIAS( const LIB_ALIAS& aAlias, LIB_PART* aRootPart ) :
|
||||
EDA_ITEM( aAlias ),
|
||||
shared( aRootPart ),
|
||||
tmpUnit( 0 ),
|
||||
tmpConversion( 0 )
|
||||
shared( aRootPart )
|
||||
{
|
||||
name = aAlias.name;
|
||||
|
||||
@@ -534,7 +530,7 @@ void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
|
||||
}
|
||||
|
||||
// Not filled items and filled shapes are now plotted
|
||||
// (plot only items which are not already plotted)
|
||||
// Items that have BG fills only get re-stroked to ensure the edges are in the foreground
|
||||
for( LIB_ITEM& item : m_drawings )
|
||||
{
|
||||
if( item.Type() == LIB_FIELD_T )
|
||||
@@ -546,8 +542,7 @@ void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
|
||||
if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
|
||||
continue;
|
||||
|
||||
if( item.m_Fill != FILLED_WITH_BG_BODYCOLOR )
|
||||
item.Plot( aPlotter, aOffset, fill, aTransform );
|
||||
item.Plot( aPlotter, aOffset, fill && ( item.m_Fill != FILLED_WITH_BG_BODYCOLOR ), aTransform );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,8 +595,7 @@ void LIB_PART::RemoveDrawItem( LIB_ITEM* aItem, EDA_DRAW_PANEL* aPanel, wxDC* aD
|
||||
{
|
||||
wxLogWarning( _(
|
||||
"An attempt was made to remove the %s field from component %s in library %s." ),
|
||||
GetChars( field->GetName() ), GetChars( GetName() ),
|
||||
GetChars( GetLibraryName() ) );
|
||||
field->GetName( TRANSLATE_FIELD_NAME ), GetName(), GetLibraryName() );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -721,6 +715,15 @@ bool LIB_PART::PinsConflictWith( LIB_PART& aOtherPart, bool aTestNums, bool aTes
|
||||
for( LIB_PIN* eachOtherPin : otherPinList )
|
||||
{
|
||||
wxASSERT( eachOtherPin );
|
||||
|
||||
// Same unit?
|
||||
if( eachThisPin->GetUnit() != eachOtherPin->GetUnit() )
|
||||
continue;
|
||||
|
||||
// Same body stype?
|
||||
if( eachThisPin->GetConvert() != eachOtherPin->GetConvert() )
|
||||
continue;
|
||||
|
||||
// Same position?
|
||||
if( eachThisPin->GetPosition() != eachOtherPin->GetPosition() )
|
||||
continue;
|
||||
@@ -746,6 +749,7 @@ bool LIB_PART::PinsConflictWith( LIB_PART& aOtherPart, bool aTestNums, bool aTes
|
||||
continue;
|
||||
|
||||
foundMatch = true;
|
||||
break; // Match found so seach is complete.
|
||||
}
|
||||
|
||||
if( !foundMatch )
|
||||
@@ -899,7 +903,7 @@ LIB_FIELD* LIB_PART::FindField( const wxString& aFieldName )
|
||||
{
|
||||
LIB_FIELD* field = ( LIB_FIELD* ) &item;
|
||||
|
||||
if( field->GetName() == aFieldName )
|
||||
if( field->GetName( NATIVE_FIELD_NAME ) == aFieldName )
|
||||
return field;
|
||||
}
|
||||
|
||||
@@ -931,45 +935,6 @@ LIB_FIELD& LIB_PART::GetFootprintField()
|
||||
}
|
||||
|
||||
|
||||
bool LIB_PART::SaveDateAndTime( OUTPUTFORMATTER& aFormatter )
|
||||
{
|
||||
int year, mon, day, hour, min, sec;
|
||||
|
||||
if( m_dateLastEdition == 0 )
|
||||
return true;
|
||||
|
||||
sec = m_dateLastEdition & 63;
|
||||
min = ( m_dateLastEdition >> 6 ) & 63;
|
||||
hour = ( m_dateLastEdition >> 12 ) & 31;
|
||||
day = ( m_dateLastEdition >> 17 ) & 31;
|
||||
mon = ( m_dateLastEdition >> 22 ) & 15;
|
||||
year = ( m_dateLastEdition >> 26 ) + 1990;
|
||||
|
||||
aFormatter.Print( 0, "Ti %d/%d/%d %d:%d:%d\n", year, mon, day, hour, min, sec );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool LIB_PART::LoadDateAndTime( char* aLine )
|
||||
{
|
||||
int year, mon, day, hour, min, sec;
|
||||
|
||||
year = mon = day = hour = min = sec = 0;
|
||||
strtok( aLine, " \r\t\n" );
|
||||
strtok( NULL, " \r\t\n" );
|
||||
|
||||
if( sscanf( aLine, "%d/%d/%d %d:%d:%d", &year, &mon, &day, &hour, &min, &sec ) != 6 )
|
||||
return false;
|
||||
|
||||
m_dateLastEdition = ( sec & 63 ) + ( ( min & 63 ) << 6 ) +
|
||||
( ( hour & 31 ) << 12 ) + ( ( day & 31 ) << 17 ) +
|
||||
( ( mon & 15 ) << 22 ) + ( ( year - 1990 ) << 26 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void LIB_PART::SetOffset( const wxPoint& aOffset )
|
||||
{
|
||||
for( LIB_ITEM& item : m_drawings )
|
||||
|
||||
@@ -87,9 +87,6 @@ protected:
|
||||
wxString keyWords; ///< keyword list (used for search for parts by keyword)
|
||||
wxString docFileName; ///< Associate doc file name
|
||||
|
||||
int tmpUnit; ///< Temporary unit designator (used for rendering)
|
||||
int tmpConversion; ///< Temporary conversion designator (used for rendering)
|
||||
|
||||
public:
|
||||
LIB_ALIAS( const wxString& aName, LIB_PART* aRootComponent );
|
||||
LIB_ALIAS( const LIB_ALIAS& aAlias, LIB_PART* aRootComponent = NULL );
|
||||
@@ -174,12 +171,6 @@ public:
|
||||
*/
|
||||
wxString GetUnitReference( int aUnit ) override;
|
||||
|
||||
/**
|
||||
* A temporary conversion (deMorgan) designation for rendering, preview, etc.
|
||||
*/
|
||||
void SetTmpConversion( int aConversion ) { tmpConversion = aConversion; }
|
||||
int GetTmpConversion() { return tmpConversion; }
|
||||
|
||||
/**
|
||||
* KEEPCASE sensitive comparison of the part entry name.
|
||||
*/
|
||||
@@ -272,8 +263,6 @@ class LIB_PART : public EDA_ITEM
|
||||
private:
|
||||
void deleteAllFields();
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
LIB_PART( const wxString& aName, PART_LIB* aLibrary = NULL );
|
||||
@@ -377,26 +366,6 @@ public:
|
||||
return GetUnitBoundingBox( 0, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the date and time of part to \a aFile in the format:
|
||||
* "Ti yy/mm/jj hh:mm:ss"
|
||||
*
|
||||
* @param aFormatter A reference to an #OUTPUTFORMATTER object containing the
|
||||
* output format to write to.
|
||||
* @return True if the date and time were successfully written to \a aFormatter.
|
||||
*/
|
||||
bool SaveDateAndTime( OUTPUTFORMATTER& aFormatter );
|
||||
|
||||
bool LoadDateAndTime( char* aLine );
|
||||
|
||||
/**
|
||||
* Write the data structures out to \a aFormatter in the part library "*.lib" format.
|
||||
*
|
||||
* @param aFormatter A reference to an OUTPUTFORMATTER to write to.
|
||||
* @return True if success writing else false.
|
||||
*/
|
||||
bool Save( OUTPUTFORMATTER& aFormatter );
|
||||
|
||||
bool IsPower() const { return m_options == ENTRY_POWER; }
|
||||
bool IsNormal() const { return m_options == ENTRY_NORMAL; }
|
||||
|
||||
@@ -434,7 +403,8 @@ public:
|
||||
void GetFields( LIB_FIELDS& aList );
|
||||
|
||||
/**
|
||||
* Findd a field within this part matching \a aFieldName and returns it or NULL if not found.
|
||||
* Find a field within this part matching \a aFieldName and returns it
|
||||
* or NULL if not found.
|
||||
*/
|
||||
LIB_FIELD* FindField( const wxString& aFieldName );
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
|
||||
dlg.SetOKLabel( _( "Clear and Annotate" ) );
|
||||
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||
|
||||
if( dlg.ShowModal() == wxCANCEL )
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -484,7 +484,6 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
|
||||
// parts.
|
||||
if( m_cmp->GetUnitCount() > 1 )
|
||||
{
|
||||
const LIB_ID thisLibId = m_cmp->GetLibId();
|
||||
const wxString thisRef = m_cmp->GetRef( &( GetParent()->GetCurrentSheet() ) );
|
||||
int thisUnit = m_cmp->GetUnit();
|
||||
|
||||
@@ -495,9 +494,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
|
||||
{
|
||||
SCH_REFERENCE component = components[i];
|
||||
|
||||
if( component.GetLibPart()->GetLibId() == thisLibId
|
||||
&& component.GetRef() == thisRef
|
||||
&& component.GetUnit() != thisUnit )
|
||||
if( component.GetRef() == thisRef && component.GetUnit() != thisUnit )
|
||||
{
|
||||
SCH_COMPONENT* otherUnit = component.GetComp();
|
||||
GetParent()->SaveCopyInUndoList( otherUnit, UR_CHANGED, true /* append */);
|
||||
|
||||
@@ -456,20 +456,8 @@ void DIALOG_EDIT_COMPONENTS_LIBID::initDlg()
|
||||
candidate.m_Screen = item.GetSheetPath().LastScreen();
|
||||
SCH_SHEET_PATH sheetpath = item.GetSheetPath();
|
||||
candidate.m_Reference = candidate.m_Component->GetRef( &sheetpath );
|
||||
// For multi units per package , add unit id.
|
||||
// however, there is a problem: the unit id stored is always >= 1
|
||||
// and 1 for no multi units.
|
||||
// so add unit id only if unit > 1 if the unit count is > 1
|
||||
// (can be 0 if the symbol is not found)
|
||||
int unit = candidate.m_Component->GetUnitSelection( &sheetpath );
|
||||
int unitcount = candidate.m_Component->GetUnitCount();
|
||||
candidate.m_IsOrphan = ( unitcount == 0 );
|
||||
|
||||
if( unitcount > 1 || unit > 1 )
|
||||
{
|
||||
candidate.m_Reference << wxChar( ('A' + unit -1) );
|
||||
}
|
||||
|
||||
m_components.push_back( candidate );
|
||||
}
|
||||
#endif
|
||||
@@ -484,14 +472,12 @@ void DIALOG_EDIT_COMPONENTS_LIBID::initDlg()
|
||||
wxString last_str_libid = m_components.front().GetStringLibId();
|
||||
int row = 0;
|
||||
wxString refs;
|
||||
wxString last_ref;
|
||||
bool mark_cell = m_components.front().m_IsOrphan;
|
||||
CMP_CANDIDATE* cmp = nullptr;
|
||||
|
||||
for( unsigned ii = 0; ii < m_components.size(); ii++ )
|
||||
for( auto& cmp : m_components )
|
||||
{
|
||||
cmp = &m_components[ii];
|
||||
|
||||
wxString str_libid = cmp->GetStringLibId();
|
||||
wxString str_libid = cmp.GetStringLibId();
|
||||
|
||||
if( last_str_libid != str_libid )
|
||||
{
|
||||
@@ -499,17 +485,24 @@ void DIALOG_EDIT_COMPONENTS_LIBID::initDlg()
|
||||
AddRowToGrid( mark_cell, refs, last_str_libid );
|
||||
|
||||
// prepare next entry
|
||||
mark_cell = cmp->m_IsOrphan;
|
||||
mark_cell = cmp.m_IsOrphan;
|
||||
last_str_libid = str_libid;
|
||||
refs.Empty();
|
||||
row++;
|
||||
}
|
||||
else if( cmp.GetSchematicReference() == last_ref )
|
||||
{
|
||||
cmp.m_Row = row;
|
||||
continue;
|
||||
}
|
||||
|
||||
last_ref = cmp.GetSchematicReference();
|
||||
|
||||
if( !refs.IsEmpty() )
|
||||
refs += wxT( ", " );
|
||||
|
||||
refs += cmp->GetSchematicReference();
|
||||
cmp->m_Row = row;
|
||||
refs += cmp.GetSchematicReference();
|
||||
cmp.m_Row = row;
|
||||
}
|
||||
|
||||
// Add last component group:
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <confirm.h>
|
||||
#include <kicad_string.h>
|
||||
#include <sch_base_frame.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <sch_component.h>
|
||||
#include <class_libentry.h>
|
||||
#include <lib_field.h>
|
||||
@@ -43,7 +44,7 @@
|
||||
#include <sch_validators.h>
|
||||
|
||||
#include <dialog_edit_one_field.h>
|
||||
|
||||
#include <sch_reference_list.h>
|
||||
|
||||
// These should probably moved into some other file as helpers.
|
||||
EDA_TEXT_HJUSTIFY_T IntToEdaTextHorizJustify( int aHorizJustify )
|
||||
@@ -151,10 +152,15 @@ void DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick( wxCommandEvent& aEvent
|
||||
|
||||
void DIALOG_EDIT_ONE_FIELD::OnSetFocusText( wxFocusEvent& event )
|
||||
{
|
||||
|
||||
#ifdef __WXGTK__
|
||||
// Force an update of the text control before setting the text selection
|
||||
// This is needed because GTK seems to ignore the selection on first update
|
||||
//
|
||||
// Note that we can't do this on OSX as it tends to provoke Apple's
|
||||
// "[NSAlert runModal] may not be invoked inside of transaction begin/commit pair"
|
||||
// bug. See: https://bugs.launchpad.net/kicad/+bug/1837225
|
||||
m_TextValue->Update();
|
||||
#endif
|
||||
|
||||
if( m_fieldId == REFERENCE )
|
||||
SelectReferenceNumber( static_cast<wxTextEntry*>( m_TextValue ) );
|
||||
@@ -270,12 +276,13 @@ DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent,
|
||||
|
||||
void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH* aSheetPath )
|
||||
{
|
||||
SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
|
||||
SCH_COMPONENT* component = dynamic_cast<SCH_COMPONENT*>( aField->GetParent() );
|
||||
int fieldType = aField->GetId();
|
||||
|
||||
if( aField->GetId() == REFERENCE )
|
||||
{
|
||||
wxASSERT( aSheetPath );
|
||||
|
||||
SCH_COMPONENT* component = dynamic_cast< SCH_COMPONENT* >( aField->GetParent() );
|
||||
|
||||
wxASSERT( component );
|
||||
|
||||
if( component )
|
||||
@@ -299,9 +306,31 @@ void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH*
|
||||
aField->SetText( m_text );
|
||||
updateText( aField );
|
||||
|
||||
if( positioningModified )
|
||||
// The value, footprint and datasheet fields should be kept in sync in multi-unit
|
||||
// parts.
|
||||
if( editFrame && component && component->GetUnitCount() > 1
|
||||
&& ( fieldType == VALUE || fieldType == FOOTPRINT || fieldType == DATASHEET ) )
|
||||
{
|
||||
auto component = static_cast< SCH_COMPONENT* >( aField->GetParent() );
|
||||
component->ClearFieldsAutoplaced();
|
||||
const wxString thisRef = component->GetRef( &( editFrame->GetCurrentSheet() ) );
|
||||
int thisUnit = component->GetUnit();
|
||||
|
||||
SCH_REFERENCE_LIST components;
|
||||
editFrame->GetCurrentSheet().GetComponents( components );
|
||||
|
||||
for( unsigned i = 0; i < components.GetCount(); i++ )
|
||||
{
|
||||
SCH_REFERENCE componentRef = components[i];
|
||||
|
||||
if( componentRef.GetRef() == thisRef && componentRef.GetUnit() != thisUnit )
|
||||
{
|
||||
SCH_COMPONENT* otherUnit = componentRef.GetComp();
|
||||
editFrame->SaveCopyInUndoList( otherUnit, UR_CHANGED, true /* append */);
|
||||
otherUnit->GetField( fieldType )->SetText( m_text );
|
||||
editFrame->RefreshItem( otherUnit );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( component && positioningModified )
|
||||
component->ClearFieldsAutoplaced();
|
||||
}
|
||||
|
||||
@@ -868,10 +868,13 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::LoadFieldNames()
|
||||
// Force References to always be shown
|
||||
m_config->Write( "SymbolFieldEditor/Show/Reference", true );
|
||||
|
||||
AddField( _( "Reference" ), true, true );
|
||||
AddField( _( "Value" ), true, true );
|
||||
AddField( _( "Footprint" ), true, true );
|
||||
AddField( _( "Datasheet" ), true, false );
|
||||
// *DO NOT* use translated mandatory field names:
|
||||
// They are also used as keyword to find fields in component list.
|
||||
// Changing that is not a basic change
|
||||
AddField( "Reference", true, true );
|
||||
AddField( "Value", true, true );
|
||||
AddField( "Footprint", true, true );
|
||||
AddField( "Datasheet", true, false );
|
||||
|
||||
for( auto fieldName : userFieldNames )
|
||||
AddField( fieldName, true, false );
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jul 11 2018)
|
||||
// C++ code generated with wxFormBuilder (version Aug 15 2019)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -16,186 +16,186 @@
|
||||
DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
|
||||
wxBoxSizer* mainSizer;
|
||||
mainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
wxBoxSizer* bUpperSizer;
|
||||
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
||||
wxBoxSizer* bLeftSizer;
|
||||
bLeftSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
wxGridBagSizer* gbSizer1;
|
||||
gbSizer1 = new wxGridBagSizer( 1, 0 );
|
||||
gbSizer1 = new wxGridBagSizer( 5, 5 );
|
||||
gbSizer1->SetFlexibleDirection( wxBOTH );
|
||||
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
|
||||
m_pinNameLabel = new wxStaticText( this, wxID_ANY, _("Pin &name:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pinNameLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_pinNameLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_textPinName = new wxTextCtrl( this, ID_M_TEXTPINNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_textPinName, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ), wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_pinNumberLabel = new wxStaticText( this, ID_M_STATICTEXTPADNAME, _("Pin n&umber:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_pinNameLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_textPinName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_textPinName, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_pinNumberLabel = new wxStaticText( this, wxID_ANY, _("Pin num&ber:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pinNumberLabel->Wrap( -1 );
|
||||
m_pinNumberLabel->SetToolTip( _("Pin number: 1 to 4 ASCII letters and/or digits") );
|
||||
|
||||
gbSizer1->Add( m_pinNumberLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_textPinNumber = new wxTextCtrl( this, ID_M_TEXTPADNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_textPinNumber, wxGBPosition( 1, 1 ), wxGBSpan( 1, 2 ), wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextEType = new wxStaticText( this, wxID_ANY, _("&Electrical type:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextEType->Wrap( -1 );
|
||||
m_staticTextEType->SetToolTip( _("Used by the ERC.") );
|
||||
|
||||
gbSizer1->Add( m_staticTextEType, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_choiceElectricalType = new PinTypeComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||
gbSizer1->Add( m_choiceElectricalType, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextGstyle = new wxStaticText( this, wxID_ANY, _("Graphic style:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextGstyle->Wrap( -1 );
|
||||
gbSizer1->Add( m_staticTextGstyle, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_choiceStyle = new PinShapeComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||
gbSizer1->Add( m_choiceStyle, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
m_posXLabel = new wxStaticText( this, wxID_ANY, _("X position:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
||||
gbSizer1->Add( m_pinNumberLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_textPinNumber = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_textPinNumber, wxGBPosition( 1, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_posXLabel = new wxStaticText( this, wxID_ANY, _("&X position:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_posXLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_posXLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
gbSizer1->Add( m_posXLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_posXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_posXCtrl->SetMinSize( wxSize( 110,-1 ) );
|
||||
|
||||
gbSizer1->Add( m_posXCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
|
||||
gbSizer1->Add( m_posXCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_posYLabel = new wxStaticText( this, wxID_ANY, _("&Y position:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_posYLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_posYLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_posYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_posYCtrl, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_pinLengthLabel = new wxStaticText( this, wxID_ANY, _("&Pin length:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pinLengthLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_pinLengthLabel, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_pinLengthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_pinLengthCtrl, wxGBPosition( 7, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_nameSizeLabel = new wxStaticText( this, wxID_ANY, _("N&ame text size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_nameSizeLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_nameSizeLabel, wxGBPosition( 8, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_nameSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_nameSizeCtrl, wxGBPosition( 8, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_numberSizeLabel = new wxStaticText( this, wxID_ANY, _("Number text si&ze:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_numberSizeLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_numberSizeLabel, wxGBPosition( 9, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_numberSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_numberSizeCtrl, wxGBPosition( 9, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_staticTextEType = new wxStaticText( this, wxID_ANY, _("Electrical type:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextEType->Wrap( -1 );
|
||||
m_staticTextEType->SetToolTip( _("Used by the ERC.") );
|
||||
|
||||
gbSizer1->Add( m_staticTextEType, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_choiceElectricalType = new PinTypeComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN|wxCB_READONLY );
|
||||
gbSizer1->Add( m_choiceElectricalType, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_staticTextGstyle = new wxStaticText( this, wxID_ANY, _("Graphic style:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextGstyle->Wrap( -1 );
|
||||
gbSizer1->Add( m_staticTextGstyle, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_choiceStyle = new PinShapeComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN|wxCB_READONLY );
|
||||
gbSizer1->Add( m_choiceStyle, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_staticTextOrient = new wxStaticText( this, wxID_ANY, _("Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextOrient->Wrap( -1 );
|
||||
gbSizer1->Add( m_staticTextOrient, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_choiceOrientation = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN|wxCB_READONLY );
|
||||
gbSizer1->Add( m_choiceOrientation, wxGBPosition( 6, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_posXUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_posXUnits->Wrap( -1 );
|
||||
gbSizer1->Add( m_posXUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
|
||||
|
||||
m_posYLabel = new wxStaticText( this, wxID_ANY, _("Y position:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_posYLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_posYLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_posYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_posYCtrl, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
gbSizer1->Add( m_posXUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_posYUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_posYUnits->Wrap( -1 );
|
||||
gbSizer1->Add( m_posYUnits, wxGBPosition( 5, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
|
||||
|
||||
m_staticTextOrient = new wxStaticText( this, wxID_ANY, _("&Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextOrient->Wrap( -1 );
|
||||
gbSizer1->Add( m_staticTextOrient, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_choiceOrientation = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||
gbSizer1->Add( m_choiceOrientation, wxGBPosition( 6, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
m_pinLengthLabel = new wxStaticText( this, ID_M_STATICTEXTPINLEN, _("Pin length:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pinLengthLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_pinLengthLabel, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_pinLengthCtrl = new wxTextCtrl( this, ID_M_TEXTLENGTH, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_pinLengthCtrl, wxGBPosition( 7, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
m_pinLengthUnits = new wxStaticText( this, ID_M_STATICLENGTHUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_posYUnits, wxGBPosition( 5, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_pinLengthUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pinLengthUnits->Wrap( -1 );
|
||||
gbSizer1->Add( m_pinLengthUnits, wxGBPosition( 7, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
|
||||
|
||||
m_nameSizeLabel = new wxStaticText( this, ID_M_STATICTEXTNAMESIZE, _("N&ame text size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_nameSizeLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_nameSizeLabel, wxGBPosition( 8, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_nameSizeCtrl = new wxTextCtrl( this, ID_M_TEXTPINNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_nameSizeCtrl, wxGBPosition( 8, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
m_nameSizeUnits = new wxStaticText( this, ID_M_STATICNAMETEXTSIZEUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_pinLengthUnits, wxGBPosition( 7, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_nameSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_nameSizeUnits->Wrap( -1 );
|
||||
gbSizer1->Add( m_nameSizeUnits, wxGBPosition( 8, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
|
||||
|
||||
m_numberSizeLabel = new wxStaticText( this, ID_M_STATICTEXTPADNAMESIZE, _("Number te&xt size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_numberSizeLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_numberSizeLabel, wxGBPosition( 9, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_numberSizeCtrl = new wxTextCtrl( this, ID_M_TEXTPADNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_numberSizeCtrl, wxGBPosition( 9, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_numberSizeUnits = new wxStaticText( this, ID_M_STATICNUMBERTEXTSIZEUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_nameSizeUnits, wxGBPosition( 8, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_numberSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_numberSizeUnits->Wrap( -1 );
|
||||
gbSizer1->Add( m_numberSizeUnits, wxGBPosition( 9, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
gbSizer1->Add( m_numberSizeUnits, wxGBPosition( 9, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
gbSizer1->AddGrowableCol( 1 );
|
||||
|
||||
bLeftSizer->Add( gbSizer1, 1, wxEXPAND|wxTOP, 5 );
|
||||
|
||||
|
||||
|
||||
bLeftSizer->Add( gbSizer1, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bUpperSizer->Add( bLeftSizer, 1, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
wxBoxSizer* bRightSizer;
|
||||
bRightSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
wxBoxSizer* checkboxesSizer;
|
||||
checkboxesSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
m_checkApplyToAllParts = new wxCheckBox( this, wxID_ANY, _("Common to all &units in symbol"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
checkboxesSizer->Add( m_checkApplyToAllParts, 0, wxALL, 3 );
|
||||
|
||||
checkboxesSizer->Add( m_checkApplyToAllParts, 0, wxBOTTOM, 3 );
|
||||
|
||||
m_checkApplyToAllConversions = new wxCheckBox( this, wxID_ANY, _("Common to all body &styles (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
checkboxesSizer->Add( m_checkApplyToAllConversions, 0, wxALL, 3 );
|
||||
|
||||
|
||||
checkboxesSizer->Add( m_checkApplyToAllConversions, 0, wxBOTTOM, 3 );
|
||||
|
||||
|
||||
checkboxesSizer->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
m_checkShow = new wxCheckBox( this, wxID_ANY, _("&Visible"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_checkShow->SetValue(true);
|
||||
checkboxesSizer->Add( m_checkShow, 0, wxALL, 3 );
|
||||
|
||||
|
||||
m_checkShow->SetValue(true);
|
||||
checkboxesSizer->Add( m_checkShow, 0, wxBOTTOM, 3 );
|
||||
|
||||
|
||||
bRightSizer->Add( checkboxesSizer, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
m_panelShowPin = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL );
|
||||
m_panelShowPin->SetMinSize( wxSize( 150,150 ) );
|
||||
|
||||
bRightSizer->Add( m_panelShowPin, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
|
||||
bRightSizer->Add( m_panelShowPin, 1, wxEXPAND|wxLEFT, 5 );
|
||||
|
||||
|
||||
bUpperSizer->Add( bRightSizer, 1, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
mainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
|
||||
mainSizer->Add( bUpperSizer, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
mainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
mainSizer->Add( m_staticline1, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_sdbSizerButtons = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK );
|
||||
m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL );
|
||||
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
|
||||
m_sdbSizerButtons->Realize();
|
||||
|
||||
|
||||
mainSizer->Add( m_sdbSizerButtons, 0, wxALL|wxALIGN_RIGHT, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
this->SetSizer( mainSizer );
|
||||
this->Layout();
|
||||
mainSizer->Fit( this );
|
||||
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
|
||||
// Connect Events
|
||||
m_textPinName->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_textPinNumber->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceElectricalType->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceStyle->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceOrientation->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_pinLengthCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_nameSizeCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_numberSizeCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceElectricalType->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceStyle->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceOrientation->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_checkApplyToAllParts->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_checkApplyToAllConversions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_checkShow->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
@@ -207,15 +207,15 @@ DIALOG_LIB_EDIT_PIN_BASE::~DIALOG_LIB_EDIT_PIN_BASE()
|
||||
// Disconnect Events
|
||||
m_textPinName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_textPinNumber->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceElectricalType->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceStyle->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceOrientation->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_pinLengthCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_nameSizeCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_numberSizeCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceElectricalType->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceStyle->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceOrientation->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_checkApplyToAllParts->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_checkApplyToAllConversions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_checkShow->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_panelShowPin->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPaintShowPanel ), NULL, this );
|
||||
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,11 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jul 11 2018)
|
||||
// C++ code generated with wxFormBuilder (version Aug 15 2019)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DIALOG_LIB_EDIT_PIN_BASE_H__
|
||||
#define __DIALOG_LIB_EDIT_PIN_BASE_H__
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
@@ -40,48 +39,32 @@ class wxBitmapComboBox;
|
||||
class DIALOG_LIB_EDIT_PIN_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
protected:
|
||||
enum
|
||||
{
|
||||
ID_M_TEXTPINNAME = 1000,
|
||||
ID_M_STATICTEXTPADNAME,
|
||||
ID_M_TEXTPADNAME,
|
||||
ID_M_STATICTEXTPINLEN,
|
||||
ID_M_TEXTLENGTH,
|
||||
ID_M_STATICLENGTHUNITS,
|
||||
ID_M_STATICTEXTNAMESIZE,
|
||||
ID_M_TEXTPINNAMETEXTSIZE,
|
||||
ID_M_STATICNAMETEXTSIZEUNITS,
|
||||
ID_M_STATICTEXTPADNAMESIZE,
|
||||
ID_M_TEXTPADNAMETEXTSIZE,
|
||||
ID_M_STATICNUMBERTEXTSIZEUNITS
|
||||
};
|
||||
|
||||
wxStaticText* m_pinNameLabel;
|
||||
wxTextCtrl* m_textPinName;
|
||||
wxStaticText* m_pinNumberLabel;
|
||||
wxTextCtrl* m_textPinNumber;
|
||||
wxStaticText* m_posXLabel;
|
||||
wxTextCtrl* m_posXCtrl;
|
||||
wxStaticText* m_posYLabel;
|
||||
wxTextCtrl* m_posYCtrl;
|
||||
wxStaticText* m_pinLengthLabel;
|
||||
wxTextCtrl* m_pinLengthCtrl;
|
||||
wxStaticText* m_nameSizeLabel;
|
||||
wxTextCtrl* m_nameSizeCtrl;
|
||||
wxStaticText* m_numberSizeLabel;
|
||||
wxTextCtrl* m_numberSizeCtrl;
|
||||
wxStaticText* m_staticTextEType;
|
||||
PinTypeComboBox* m_choiceElectricalType;
|
||||
wxStaticText* m_staticTextGstyle;
|
||||
PinShapeComboBox* m_choiceStyle;
|
||||
wxStaticText* m_posXLabel;
|
||||
wxTextCtrl* m_posXCtrl;
|
||||
wxStaticText* m_posXUnits;
|
||||
wxStaticText* m_posYLabel;
|
||||
wxTextCtrl* m_posYCtrl;
|
||||
wxStaticText* m_posYUnits;
|
||||
wxStaticText* m_staticTextOrient;
|
||||
wxBitmapComboBox* m_choiceOrientation;
|
||||
wxStaticText* m_pinLengthLabel;
|
||||
wxTextCtrl* m_pinLengthCtrl;
|
||||
wxStaticText* m_posXUnits;
|
||||
wxStaticText* m_posYUnits;
|
||||
wxStaticText* m_pinLengthUnits;
|
||||
wxStaticText* m_nameSizeLabel;
|
||||
wxTextCtrl* m_nameSizeCtrl;
|
||||
wxStaticText* m_nameSizeUnits;
|
||||
wxStaticText* m_numberSizeLabel;
|
||||
wxTextCtrl* m_numberSizeCtrl;
|
||||
wxStaticText* m_numberSizeUnits;
|
||||
wxCheckBox* m_checkApplyToAllParts;
|
||||
wxCheckBox* m_checkApplyToAllConversions;
|
||||
@@ -91,17 +74,16 @@ class DIALOG_LIB_EDIT_PIN_BASE : public DIALOG_SHIM
|
||||
wxStdDialogButtonSizer* m_sdbSizerButtons;
|
||||
wxButton* m_sdbSizerButtonsOK;
|
||||
wxButton* m_sdbSizerButtonsCancel;
|
||||
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnPropertiesChange( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnPaintShowPanel( wxPaintEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
|
||||
DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_LIB_EDIT_PIN_BASE();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif //__DIALOG_LIB_EDIT_PIN_BASE_H__
|
||||
|
||||
@@ -309,6 +309,9 @@ public:
|
||||
ascending = GetView()->IsSortOrderAscending();
|
||||
}
|
||||
|
||||
for( LIB_PINS& row : m_rows )
|
||||
SortPins( row );
|
||||
|
||||
SortRows( sortCol, ascending );
|
||||
|
||||
if ( GetView() )
|
||||
@@ -321,8 +324,19 @@ public:
|
||||
void SortRows( int aSortCol, bool ascending )
|
||||
{
|
||||
std::sort( m_rows.begin(), m_rows.end(),
|
||||
[ aSortCol, ascending, this ]( LIB_PINS lhs, LIB_PINS rhs ) -> bool
|
||||
{ return compare( lhs, rhs, aSortCol, ascending, m_userUnits ); } );
|
||||
[ aSortCol, ascending, this ]( const LIB_PINS& lhs, const LIB_PINS& rhs ) -> bool
|
||||
{
|
||||
return compare( lhs, rhs, aSortCol, ascending, m_userUnits );
|
||||
} );
|
||||
}
|
||||
|
||||
void SortPins( LIB_PINS& aRow )
|
||||
{
|
||||
std::sort( aRow.begin(), aRow.end(),
|
||||
[]( LIB_PIN* lhs, LIB_PIN* rhs ) -> bool
|
||||
{
|
||||
return PinNumbers::Compare( lhs->GetNumber(), rhs->GetNumber() ) < 0;
|
||||
} );
|
||||
}
|
||||
|
||||
void AppendRow( LIB_PIN* aPin )
|
||||
|
||||
@@ -399,6 +399,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
|
||||
|
||||
pageSizeIU = aScreen->GetPageSettings().GetSizeIU();
|
||||
FitThisSizeToPaper( pageSizeIU );
|
||||
|
||||
fitRect = GetLogicalPaperRect();
|
||||
|
||||
wxLogDebug( wxT( "Fit rectangle: x = %d, y = %d, w = %d, h = %d" ),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user