merge with lp:kicad
This commit is contained in:
commit
db427cb2cd
|
@ -1,11 +1,14 @@
|
|||
common/netlist_keywords.*
|
||||
common/netlist_lexer.h
|
||||
common/pcb_plot_params_lexer.h
|
||||
include/netlist_lexer.h
|
||||
eeschema/cmp_library_lexer.h
|
||||
eeschema/cmp_library_keywords.*
|
||||
eeschema/template_fieldnames_keywords.*
|
||||
eeschema/template_fieldnames_lexer.h
|
||||
pcbnew/dialogs/dialog_freeroute_exchange_help_html.h
|
||||
pcbnew/pcb_plot_params_keywords.cpp
|
||||
pcbnew/pcb_plot_params_lexer.h
|
||||
Makefile
|
||||
CMakeFiles
|
||||
CMakeCache.txt
|
||||
|
@ -30,3 +33,5 @@ new/sweet_keywords.cpp
|
|||
new/sweet_lexer.h
|
||||
bitmaps_png/png*
|
||||
bitmaps_png/tmp
|
||||
common/pcb_keywords.cpp
|
||||
include/pcb_lexer.h
|
||||
|
|
|
@ -177,7 +177,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
|||
// because all boards thickness no not match with this setup:
|
||||
// double epoxy_width = 1.6; // epoxy width in mm
|
||||
|
||||
g_Parm_3D_Visu.m_Epoxy_Width = pcb->GetDesignSettings().m_BoardThickness
|
||||
g_Parm_3D_Visu.m_Epoxy_Width = pcb->GetDesignSettings().GetBoardThickness()
|
||||
* g_Parm_3D_Visu.m_BoardScale;
|
||||
|
||||
// calculate z position for each layer
|
||||
|
|
|
@ -80,11 +80,11 @@ else (KICAD_STABLE_VERSION )
|
|||
endif(KICAD_STABLE_VERSION )
|
||||
|
||||
# Nanometers must be enabled when USE_PCBNEW_SEXPR_FILE_FORMAT=ON.
|
||||
if( USE_PCBNEW_SEXPR_FILE_FORMAT AND NOT USE_PCBNEW_NANOMETRES )
|
||||
set( TMP "The Pcbnew s-expression file format requires nano-meter internal units to be " )
|
||||
set( TMP "${TMP} enabled using -DUSE_PCBNEW_NANOMETRES=ON." )
|
||||
message( FATAL_ERROR ${TMP} )
|
||||
endif( USE_PCBNEW_SEXPR_FILE_FORMAT AND NOT USE_PCBNEW_NANOMETRES )
|
||||
#if( USE_PCBNEW_SEXPR_FILE_FORMAT AND NOT USE_PCBNEW_NANOMETRES )
|
||||
# set( TMP "The Pcbnew s-expression file format requires nano-meter internal units to be " )
|
||||
# set( TMP "${TMP} enabled using -DUSE_PCBNEW_NANOMETRES=ON." )
|
||||
# message( FATAL_ERROR ${TMP} )
|
||||
#endif( USE_PCBNEW_SEXPR_FILE_FORMAT AND NOT USE_PCBNEW_NANOMETRES )
|
||||
|
||||
#================================================
|
||||
# Set flags for GCC.
|
||||
|
|
|
@ -496,6 +496,7 @@ set( BMAPS_MID
|
|||
window_close
|
||||
zip_tool
|
||||
zip
|
||||
zone_duplicate
|
||||
zone_unfill
|
||||
zoom
|
||||
zoom_area
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
|
||||
/* Do not modify this file, it was automatically generated by the
|
||||
* PNG2cpp CMake script, using a *.png file as input.
|
||||
*/
|
||||
|
||||
#include <bitmaps.h>
|
||||
|
||||
static const unsigned char png[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
|
||||
0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c,
|
||||
0xce, 0x00, 0x00, 0x05, 0x8a, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xb5, 0x95, 0x7b, 0x4c, 0x53,
|
||||
0x57, 0x18, 0xc0, 0xbf, 0x16, 0x6c, 0xa1, 0x2d, 0x85, 0x96, 0xd2, 0x42, 0x2d, 0xe5, 0xf6, 0x71,
|
||||
0x6f, 0x1f, 0x3c, 0x0a, 0x02, 0xe5, 0xa1, 0x2d, 0x2d, 0xe5, 0xa1, 0xb0, 0x29, 0x0e, 0x11, 0xe2,
|
||||
0x98, 0x8f, 0xf9, 0x16, 0x9c, 0x4f, 0x06, 0xe8, 0x1c, 0x3a, 0x75, 0x8b, 0x9a, 0x0c, 0x33, 0x27,
|
||||
0xd9, 0x12, 0xa3, 0x59, 0xe6, 0x8c, 0xca, 0x36, 0x70, 0x33, 0xd1, 0xcd, 0x6c, 0x46, 0x9d, 0x3a,
|
||||
0x35, 0x1a, 0x23, 0x33, 0x9b, 0x8a, 0x32, 0xcc, 0x14, 0x50, 0x1e, 0xbe, 0x26, 0x2f, 0xe5, 0xdb,
|
||||
0xb9, 0x9d, 0x45, 0x34, 0x2a, 0x98, 0xcd, 0x3f, 0x7e, 0x39, 0x37, 0xe7, 0xe4, 0x7e, 0xbf, 0xf3,
|
||||
0x7d, 0xf7, 0x9c, 0xef, 0x82, 0xc1, 0x65, 0xb8, 0xa9, 0x1f, 0xad, 0x7f, 0x69, 0xb4, 0x2e, 0x73,
|
||||
0xab, 0xc2, 0x92, 0x76, 0x47, 0x95, 0x90, 0xd4, 0x41, 0x39, 0x2c, 0x6d, 0xfa, 0xd1, 0xf4, 0x4d,
|
||||
0x26, 0x9d, 0xbe, 0x6d, 0x4e, 0x35, 0xe4, 0x21, 0x22, 0x3c, 0x0d, 0xe8, 0x33, 0xf5, 0x2d, 0xb0,
|
||||
0x02, 0x70, 0x20, 0x9c, 0xe5, 0x1c, 0xf4, 0x5d, 0xe8, 0x83, 0xfc, 0x25, 0x7c, 0x7c, 0x7a, 0xad,
|
||||
0x9f, 0xb9, 0x32, 0xf2, 0xf6, 0xca, 0xc7, 0xc8, 0x8a, 0x50, 0xec, 0x4c, 0xe8, 0x31, 0x39, 0x4c,
|
||||
0xf9, 0x83, 0x8a, 0xbc, 0x4b, 0xbd, 0x31, 0x2c, 0x47, 0xdd, 0xca, 0x64, 0xd2, 0x0d, 0x64, 0xbe,
|
||||
0x86, 0xce, 0xd4, 0x1d, 0xa0, 0x33, 0xf4, 0xd7, 0xe4, 0x85, 0xf2, 0xbb, 0x83, 0x8a, 0x1e, 0x21,
|
||||
0x08, 0x28, 0xfa, 0xe6, 0x85, 0x22, 0xde, 0x52, 0x1e, 0x92, 0xa0, 0xcd, 0x66, 0x27, 0xe3, 0x82,
|
||||
0x95, 0x10, 0x41, 0xe6, 0x8a, 0x09, 0x6f, 0xc3, 0x32, 0x08, 0x61, 0x32, 0xf4, 0x9b, 0xf5, 0x63,
|
||||
0xb4, 0x6d, 0x9a, 0xb1, 0x54, 0x8b, 0x7a, 0xbc, 0xba, 0x8d, 0xdd, 0x10, 0x94, 0x13, 0xf2, 0x4c,
|
||||
0x08, 0xb6, 0x54, 0x04, 0xed, 0x5b, 0x8f, 0x65, 0x9c, 0x8a, 0x1e, 0x32, 0x6a, 0x9f, 0x2b, 0xa2,
|
||||
0xc6, 0x85, 0xb5, 0x99, 0x9d, 0xe6, 0x04, 0xf2, 0x5c, 0x46, 0x78, 0x38, 0x60, 0xf7, 0x1d, 0xb0,
|
||||
0x1c, 0xec, 0x7a, 0x9b, 0x3e, 0x28, 0xdc, 0x11, 0x1e, 0x6c, 0x4c, 0x35, 0x66, 0x68, 0xb3, 0xb4,
|
||||
0x6d, 0xdc, 0x72, 0xee, 0x93, 0x19, 0xc6, 0x65, 0x0f, 0xc8, 0x6c, 0x55, 0xd1, 0x33, 0x45, 0xec,
|
||||
0x0e, 0x49, 0x36, 0x75, 0xe4, 0x85, 0x70, 0x56, 0xe2, 0xbb, 0xc0, 0xb7, 0x31, 0x22, 0x4b, 0xbd,
|
||||
0xdf, 0xf4, 0xba, 0xea, 0x17, 0x2a, 0x5f, 0xde, 0x4d, 0xe8, 0xd5, 0x4d, 0x08, 0xbe, 0xae, 0xcb,
|
||||
0x53, 0xb4, 0x58, 0x32, 0xa8, 0xea, 0x38, 0x3b, 0xbd, 0x2f, 0x2a, 0x4d, 0xd7, 0x45, 0x15, 0xc8,
|
||||
0x91, 0x2a, 0x08, 0x72, 0x13, 0x9c, 0x1a, 0xdd, 0x2f, 0x92, 0xca, 0xa6, 0x9f, 0x49, 0xb0, 0xd1,
|
||||
0x9f, 0x78, 0x18, 0x61, 0x67, 0x96, 0xbb, 0x45, 0xc2, 0x62, 0x21, 0x32, 0xa3, 0xf5, 0x5b, 0x1e,
|
||||
0x95, 0x0b, 0x95, 0xf9, 0xca, 0xaa, 0xc5, 0xe1, 0xca, 0xfa, 0xef, 0x15, 0x7e, 0x47, 0x3e, 0x33,
|
||||
0x08, 0x9b, 0xd6, 0x5b, 0x04, 0xe8, 0x61, 0x43, 0x94, 0xa0, 0xb7, 0x5a, 0x25, 0x3a, 0xfd, 0x45,
|
||||
0x68, 0x40, 0x43, 0x81, 0x62, 0xd4, 0xc3, 0x08, 0xff, 0x49, 0x68, 0x16, 0x17, 0xa2, 0x56, 0x38,
|
||||
0xfd, 0xb1, 0x88, 0x5b, 0xd2, 0x19, 0xcb, 0x9f, 0x72, 0x93, 0x25, 0x9e, 0x3f, 0xf9, 0x46, 0x64,
|
||||
0x74, 0xe2, 0x5f, 0x6e, 0x91, 0xe0, 0x1d, 0x01, 0x92, 0x23, 0xbb, 0x9d, 0x94, 0xc8, 0xca, 0x8a,
|
||||
0x14, 0x93, 0x14, 0x3b, 0x37, 0x6a, 0x65, 0x67, 0x3b, 0xbd, 0xa0, 0xe6, 0x47, 0x0d, 0xb4, 0x7c,
|
||||
0x65, 0xe6, 0x62, 0xb1, 0x55, 0x8a, 0x19, 0x0e, 0x25, 0xc6, 0xbb, 0x28, 0xcc, 0xb6, 0x2b, 0x7b,
|
||||
0x2a, 0xf5, 0x81, 0x67, 0x8f, 0x4b, 0x7c, 0x1b, 0xf2, 0xc5, 0xe9, 0x0f, 0x39, 0x50, 0xf1, 0xcc,
|
||||
0x83, 0xe1, 0x07, 0xe5, 0xdd, 0xdb, 0xb8, 0x91, 0x47, 0x47, 0x8e, 0xa2, 0x2f, 0xba, 0x45, 0xdc,
|
||||
0x65, 0x5c, 0xa4, 0x33, 0xf5, 0xf5, 0xee, 0x5a, 0xbe, 0x0f, 0xa7, 0x02, 0x66, 0xf9, 0x77, 0x57,
|
||||
0x44, 0x4a, 0x5b, 0x0f, 0x68, 0xa0, 0xe9, 0xe3, 0x28, 0x1f, 0xb4, 0xba, 0xa8, 0x5e, 0x65, 0x61,
|
||||
0xd0, 0x4f, 0x3e, 0x8b, 0x7d, 0xb6, 0xf2, 0xcb, 0xe1, 0x16, 0x7b, 0xec, 0xc3, 0xf2, 0x15, 0xad,
|
||||
0x39, 0x56, 0xea, 0xf2, 0x66, 0x8d, 0xb4, 0x7d, 0x5a, 0x68, 0x4c, 0x9f, 0xc0, 0xab, 0xf4, 0x09,
|
||||
0x09, 0x0d, 0xf3, 0x3b, 0xce, 0x70, 0xe5, 0x3f, 0xb0, 0x9b, 0xed, 0x17, 0xb1, 0x59, 0x84, 0xe6,
|
||||
0xaa, 0x6e, 0x19, 0xd2, 0x0c, 0x13, 0xc9, 0x73, 0xa4, 0x64, 0x86, 0xa4, 0xa9, 0x24, 0x36, 0x00,
|
||||
0x77, 0x98, 0x39, 0x68, 0x4d, 0xd5, 0x74, 0xca, 0xa7, 0x04, 0xc5, 0xec, 0x0a, 0xf1, 0x7f, 0xf7,
|
||||
0x8e, 0x37, 0xe7, 0xcb, 0x2b, 0x62, 0x38, 0xbc, 0x29, 0x0e, 0x1e, 0x44, 0xcf, 0x00, 0x94, 0xcc,
|
||||
0x16, 0x9f, 0x8f, 0x4b, 0xa1, 0x2b, 0x2d, 0x4e, 0xba, 0x39, 0x32, 0x29, 0xaa, 0x4f, 0xcd, 0x9f,
|
||||
0xd7, 0xc7, 0x4a, 0xc6, 0x72, 0x0a, 0x1a, 0xda, 0xbc, 0x78, 0x7b, 0x58, 0x09, 0x4b, 0xf2, 0x28,
|
||||
0xfa, 0x52, 0xbf, 0xc8, 0xab, 0xcc, 0x8b, 0xcd, 0xaa, 0x95, 0x71, 0x31, 0x39, 0x26, 0xa7, 0x71,
|
||||
0xda, 0x7a, 0x26, 0xf0, 0x8f, 0xd5, 0xc6, 0xa0, 0xba, 0x58, 0x3b, 0xb3, 0xe0, 0x03, 0x83, 0xac,
|
||||
0x72, 0x5f, 0xb0, 0xa0, 0x67, 0xbf, 0x42, 0xd8, 0x7e, 0x9b, 0xcb, 0x59, 0xfd, 0x5b, 0x20, 0x1c,
|
||||
0xdb, 0xc3, 0x40, 0x5f, 0x6e, 0x3e, 0xe0, 0xd8, 0x37, 0xe1, 0xc8, 0x11, 0x8a, 0x9f, 0xc4, 0x64,
|
||||
0x30, 0x57, 0x13, 0x47, 0x32, 0x7d, 0xeb, 0x84, 0xd1, 0x97, 0x3c, 0x82, 0x01, 0xa2, 0x8b, 0x4f,
|
||||
0x5c, 0x58, 0xaf, 0x72, 0x2f, 0x54, 0x8f, 0x0f, 0x6d, 0x37, 0xa4, 0x33, 0x2d, 0xab, 0x0c, 0xf2,
|
||||
0x5b, 0xa4, 0x34, 0xf7, 0x48, 0x5b, 0x69, 0xde, 0x64, 0x14, 0x75, 0xee, 0x30, 0x93, 0x2b, 0x30,
|
||||
0x39, 0xa0, 0x8b, 0xdc, 0xa9, 0x9f, 0xaf, 0xf3, 0x80, 0xfe, 0xd3, 0x1f, 0x1a, 0x4f, 0xa9, 0x01,
|
||||
0xab, 0x63, 0x01, 0x0f, 0x9b, 0xa0, 0xe1, 0xa0, 0x46, 0x98, 0x65, 0x4a, 0x35, 0xdc, 0x49, 0x4f,
|
||||
0xd2, 0x35, 0xb5, 0xf3, 0xb8, 0xdf, 0xbd, 0x50, 0xe4, 0x41, 0x32, 0x33, 0x00, 0x4b, 0xa3, 0xa5,
|
||||
0x38, 0xd2, 0x19, 0x86, 0xec, 0xf7, 0xdb, 0x90, 0x08, 0x48, 0xca, 0xe5, 0x5e, 0x93, 0x4d, 0x91,
|
||||
0xdd, 0x8b, 0x4a, 0xd7, 0x7d, 0xdd, 0xe5, 0x0d, 0xbf, 0x36, 0x06, 0x42, 0x2b, 0x2b, 0x62, 0x39,
|
||||
0x66, 0x80, 0xf3, 0x55, 0xe6, 0xa0, 0x6c, 0x4b, 0x8a, 0x61, 0x4d, 0x6e, 0x1c, 0x75, 0xe1, 0x6f,
|
||||
0x6f, 0xa8, 0x1d, 0x54, 0xe4, 0x3f, 0xcb, 0x1f, 0xd9, 0x6f, 0xf4, 0x86, 0x5d, 0x81, 0xbe, 0x8b,
|
||||
0x7c, 0x70, 0x4c, 0x01, 0xe0, 0x2e, 0x13, 0xe0, 0x6b, 0xa4, 0x54, 0xd2, 0xa5, 0x80, 0x0b, 0xad,
|
||||
0xe2, 0xfb, 0x97, 0x45, 0xc3, 0x5a, 0xba, 0x04, 0x70, 0xf2, 0x90, 0x19, 0xae, 0x7a, 0x64, 0x27,
|
||||
0x69, 0x38, 0x81, 0x81, 0x30, 0x3c, 0xde, 0xc6, 0x2c, 0x9b, 0x69, 0x51, 0xd5, 0x0d, 0x59, 0xb4,
|
||||
0x72, 0x84, 0x08, 0x35, 0xf9, 0x72, 0x14, 0x96, 0x01, 0x7e, 0x1a, 0xfb, 0xaf, 0xcc, 0xc3, 0x56,
|
||||
0x9d, 0xb0, 0x2b, 0xde, 0xa1, 0xab, 0x10, 0x17, 0xf9, 0xf1, 0xc2, 0x16, 0xc2, 0xc1, 0x2d, 0xc9,
|
||||
0x6e, 0x59, 0x5f, 0xbd, 0x1a, 0x6a, 0x6e, 0x8b, 0x41, 0x6a, 0xb5, 0xd1, 0x9f, 0xaf, 0x30, 0x06,
|
||||
0x9f, 0x1e, 0x92, 0x68, 0x37, 0x09, 0x98, 0xea, 0x54, 0xa1, 0xa8, 0x48, 0xe8, 0x96, 0x8d, 0xcb,
|
||||
0x03, 0x2c, 0xce, 0x04, 0xcc, 0x21, 0xa3, 0x6f, 0x19, 0x07, 0x99, 0x2c, 0xcd, 0xdd, 0x98, 0x14,
|
||||
0xa6, 0x79, 0x78, 0xbe, 0x92, 0x32, 0x17, 0xc1, 0xb9, 0xed, 0x56, 0xc0, 0x0b, 0x61, 0x70, 0xa2,
|
||||
0x47, 0x0a, 0x1b, 0x2f, 0x69, 0xf8, 0x22, 0x22, 0xdb, 0x5b, 0x45, 0x05, 0x1e, 0x1f, 0x92, 0x68,
|
||||
0x5b, 0xb8, 0x17, 0xba, 0x1c, 0x2a, 0xd4, 0x4c, 0x54, 0xa0, 0x70, 0xbe, 0x00, 0x79, 0x25, 0x3c,
|
||||
0xf4, 0x9b, 0x27, 0x42, 0xd2, 0x8e, 0x70, 0x8c, 0x5d, 0x89, 0x95, 0x7a, 0x69, 0x2f, 0x29, 0x55,
|
||||
0x43, 0xc0, 0x1c, 0x7f, 0xad, 0x75, 0x26, 0x5c, 0xfd, 0x3d, 0x0c, 0x8e, 0x77, 0x4b, 0xa0, 0x86,
|
||||
0xb0, 0x66, 0x15, 0x13, 0xcc, 0xca, 0x4e, 0x90, 0xf5, 0xc6, 0x41, 0x45, 0x1e, 0xd6, 0x46, 0x8b,
|
||||
0x70, 0x6a, 0xb2, 0x0c, 0xb3, 0x53, 0x42, 0x70, 0x4e, 0x82, 0x14, 0xd7, 0x91, 0x76, 0xc4, 0x96,
|
||||
0x70, 0xb7, 0x91, 0x83, 0xeb, 0x68, 0x59, 0x0f, 0x09, 0x76, 0x8e, 0xb7, 0x84, 0x67, 0xdc, 0x68,
|
||||
0x83, 0x45, 0x8f, 0x44, 0x35, 0xbd, 0x12, 0x28, 0x21, 0xf3, 0x92, 0x08, 0x87, 0xa1, 0x76, 0xc8,
|
||||
0xa2, 0x17, 0x51, 0x6d, 0xe0, 0xe0, 0x0a, 0x93, 0x82, 0x95, 0x1d, 0x22, 0x77, 0x90, 0xdb, 0x2d,
|
||||
0x85, 0x09, 0x1e, 0x59, 0x97, 0x14, 0x66, 0x91, 0x39, 0x3f, 0xa0, 0xd3, 0xe9, 0x0e, 0x36, 0xf0,
|
||||
0x40, 0x42, 0x0a, 0x82, 0xb1, 0xcc, 0x12, 0x88, 0xdf, 0x6a, 0x87, 0x0d, 0x99, 0x5a, 0x8a, 0x8f,
|
||||
0x0b, 0x22, 0x94, 0x0f, 0x88, 0xac, 0x9a, 0x6d, 0x65, 0x3d, 0x12, 0x98, 0xed, 0x91, 0x11, 0x71,
|
||||
0x2e, 0x98, 0x5c, 0x4c, 0x91, 0x31, 0xcd, 0xb8, 0x74, 0x20, 0xa6, 0x54, 0xe3, 0xce, 0x0f, 0x69,
|
||||
0xf9, 0xb5, 0x3a, 0x31, 0xbf, 0xee, 0x65, 0x99, 0x1b, 0xa5, 0xba, 0x62, 0xb5, 0x31, 0x6b, 0x49,
|
||||
0xc3, 0xe3, 0x90, 0xd2, 0x95, 0xba, 0xb3, 0x92, 0xc0, 0x66, 0x78, 0xd6, 0x6f, 0x97, 0xa4, 0x3a,
|
||||
0xd5, 0xd3, 0xbd, 0x5f, 0x96, 0xfb, 0x84, 0xc2, 0x11, 0xea, 0xf3, 0x71, 0x76, 0xa6, 0x98, 0xc8,
|
||||
0x86, 0x75, 0x4a, 0xe0, 0x23, 0x92, 0x5d, 0xd5, 0xff, 0x2e, 0x62, 0x21, 0xcd, 0xb7, 0x36, 0x27,
|
||||
0x9e, 0xba, 0x10, 0x63, 0x67, 0x26, 0xdc, 0x08, 0x02, 0x51, 0x77, 0x00, 0xbc, 0xf7, 0x4a, 0x44,
|
||||
0x2c, 0x6d, 0xa4, 0xdf, 0x65, 0x26, 0x6a, 0xeb, 0xa3, 0x1c, 0x06, 0x27, 0x2a, 0x41, 0xf0, 0xca,
|
||||
0x44, 0x2c, 0xd7, 0x7c, 0xbd, 0xf7, 0x3a, 0x93, 0x75, 0xf5, 0x24, 0x9e, 0xe5, 0x79, 0xa2, 0xf1,
|
||||
0x89, 0x36, 0xfa, 0x0a, 0x7b, 0xa3, 0xff, 0x2b, 0x6c, 0x1c, 0xd2, 0x68, 0x8f, 0xfe, 0x03, 0x4a,
|
||||
0x94, 0x41, 0xc0, 0x1e, 0x6f, 0x7c, 0x33, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae,
|
||||
0x42, 0x60, 0x82,
|
||||
};
|
||||
|
||||
const BITMAP_OPAQUE zone_duplicate_xpm[1] = {{ png, sizeof( png ), "zone_duplicate_xpm" }};
|
||||
|
||||
//EOF
|
|
@ -1,36 +1,181 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" height="48" width="48" version="1.1" viewBox="0 0 48 48">
|
||||
<defs>
|
||||
<linearGradient id="c" y2="36.848" gradientUnits="userSpaceOnUse" x2="41.355" gradientTransform="matrix(1.9192,0,0,4.3924,-53.533,-129.5)" y1="32.207" x1="39.182">
|
||||
<stop stop-color="#fff" offset="0"/>
|
||||
<stop stop-color="#afadff" offset="1"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="d" y2="36.848" gradientUnits="userSpaceOnUse" x2="41.355" gradientTransform="matrix(1.9217,0,0,4.024,-2.8365,-111.93)" y1="32.207" x1="39.182">
|
||||
<stop stop-color="#fff" offset="0"/>
|
||||
<stop stop-color="#afadff" offset="1"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect opacity=".15234" fill-rule="evenodd" ry="6.0088" height="48.071" width="48.178" y="-.082843" x="-.082843" fill="#b3b3b3"/>
|
||||
<path d="m15.412 38.774h17.273l-0.00002-32.211h-5.7576l-1.4394 2.9283h-2.8788l-1.439-2.9283h-5.7577v32.211z"/>
|
||||
<path fill="url(#c)" d="m18.291 35.846h11.515v-26.355h-1.4394l-1.4394 2.9283h-5.758l-1.44-2.928h-1.4394v26.355z"/>
|
||||
<rect transform="matrix(8.1756e-8,-1,1,9.5856e-8,0,0)" height="2.8788" width="5.8566" y="32.685" x="-18.276" fill="#ff7800"/>
|
||||
<rect transform="matrix(8.1758e-8,-1,1,9.5854e-8,0,0)" height="2.8789" width="5.8566" y="12.534" x="-18.276" fill="#ff7800"/>
|
||||
<rect transform="matrix(8.1756e-8,-1,1,9.5856e-8,0,0)" height="2.8788" width="5.8566" y="32.685" x="-27.061" fill="#ff7800"/>
|
||||
<rect transform="matrix(8.1758e-8,-1,1,9.5854e-8,0,0)" height="2.8789" width="5.8566" y="12.533" x="-27.061" fill="#ff7800"/>
|
||||
<rect transform="matrix(8.1756e-8,-1,1,9.5856e-8,0,0)" height="2.8788" width="5.8566" y="32.685" x="-35.846" fill="#ff7800"/>
|
||||
<rect transform="matrix(8.1758e-8,-1,1,9.5854e-8,0,0)" height="2.8789" width="5.8566" y="12.533" x="-35.846" fill="#ff7800"/>
|
||||
<path fill="#fff" d="m-0.85801 27.129 0.23831-5.9251 12.955 0.06852v5.8566h-13.193z"/>
|
||||
<path fill="#fff" d="m-0.42124 43.235 0.91305-5.9251 11.843-7.2522v5.8566l-12.756 7.3207z"/>
|
||||
<path fill="#fff" d="m48.956 27.129-0.23834-5.9251-12.955 0.06852v5.8566h13.193z"/>
|
||||
<path fill="#fff" d="m-0.42124 5.1672 0.91305 5.9251 11.843 7.2522v-5.8566l-12.756-7.3198z"/>
|
||||
<path fill="#fff" d="m48.519 43.235-0.91305-5.9251-11.843-7.2522v5.8566l12.756 7.3207z"/>
|
||||
<path fill="#fff" d="m48.519 5.1672-0.91305 5.9251-11.843 7.2522v-5.8566l12.756-7.3198z"/>
|
||||
<path d="m66.199 42.237h17.295l-0.00002-29.51h-5.7651l-1.4413 2.6827h-2.8826l-1.4413-2.6827h-5.7651v29.51z"/>
|
||||
<path fill="url(#d)" d="m69.081 39.554h11.53v-24.144h-1.4413l-1.4413 2.6827h-5.766l-1.441-2.683h-1.4413v24.144z"/>
|
||||
<rect transform="matrix(8.9356e-8,-1,1,8.7703e-8,0,0)" height="2.8826" width="5.3654" y="83.494" x="-23.458" fill="#d72e2e"/>
|
||||
<rect transform="matrix(8.9358e-8,-1,1,8.7701e-8,0,0)" height="2.8826" width="5.3654" y="63.316" x="-23.458" fill="#d72e2e"/>
|
||||
<rect transform="matrix(8.9356e-8,-1,1,8.7703e-8,0,0)" height="2.8826" width="5.3654" y="83.494" x="-31.506" fill="#d72e2e"/>
|
||||
<rect transform="matrix(8.9358e-8,-1,1,8.7701e-8,0,0)" height="2.8826" width="5.3654" y="63.316" x="-31.506" fill="#d72e2e"/>
|
||||
<rect transform="matrix(8.9356e-8,-1,1,8.7703e-8,0,0)" height="2.8826" width="5.3654" y="83.494" x="-39.554" fill="#d72e2e"/>
|
||||
<rect transform="matrix(8.9358e-8,-1,1,8.7701e-8,0,0)" height="2.8826" width="5.3654" y="63.316" x="-39.554" fill="#d72e2e"/>
|
||||
<path d="m28.849 14.073-7.0793 6.2502h4.5106v7.146h-1.5187v0.03624h-6.5222v-4.3135l-6.4659 6.8457 6.4659 6.8431v-4.3601h8.0409v1.09h0.03751v6.3046h-4.4624l7.082 6.2502 7.0793-6.2502h-4.5106v-7.3946h0.48213v-0.03625h6.5195v4.3135l6.466-6.8457-6.466-6.8431v4.3601h-7.0016v-0.84405h-0.03749v-6.302h4.4624l-7.082-6.2502z" fill-rule="evenodd" stroke="#44a118" stroke-width="1.421" fill="#59d421"/>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
height="48"
|
||||
width="48"
|
||||
version="1.1"
|
||||
viewBox="0 0 48 48"
|
||||
id="svg2"
|
||||
inkscape:version="0.48.1 "
|
||||
sodipodi:docname="module_ratsnest.svg">
|
||||
<metadata
|
||||
id="metadata66">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="832"
|
||||
inkscape:window-height="630"
|
||||
id="namedview64"
|
||||
showgrid="false"
|
||||
inkscape:zoom="9.049115"
|
||||
inkscape:cx="24.048995"
|
||||
inkscape:cy="24.047343"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg2" />
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
id="c"
|
||||
y2="36.848"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x2="41.355"
|
||||
gradientTransform="matrix(1.9192,0,0,4.3924,-53.533,-129.5)"
|
||||
y1="32.207"
|
||||
x1="39.182">
|
||||
<stop
|
||||
stop-color="#fff"
|
||||
offset="0"
|
||||
id="stop7" />
|
||||
<stop
|
||||
stop-color="#afadff"
|
||||
offset="1"
|
||||
id="stop9" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="d"
|
||||
y2="36.848"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x2="41.355"
|
||||
gradientTransform="matrix(1.9217,0,0,4.024,-2.8365,-111.93)"
|
||||
y1="32.207"
|
||||
x1="39.182">
|
||||
<stop
|
||||
stop-color="#fff"
|
||||
offset="0"
|
||||
id="stop12" />
|
||||
<stop
|
||||
stop-color="#afadff"
|
||||
offset="1"
|
||||
id="stop14" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect
|
||||
opacity=".15234"
|
||||
fill-rule="evenodd"
|
||||
ry="6.0088"
|
||||
height="48.071"
|
||||
width="48.178"
|
||||
y="-.082843"
|
||||
x="-.082843"
|
||||
fill="#b3b3b3"
|
||||
id="rect16" />
|
||||
<path
|
||||
d="m15.412 38.774h17.273l-0.00002-32.211h-5.7576l-1.4394 2.9283h-2.8788l-1.439-2.9283h-5.7577v32.211z"
|
||||
id="path18" />
|
||||
<path
|
||||
fill="url(#c)"
|
||||
d="m18.291 35.846h11.515v-26.355h-1.4394l-1.4394 2.9283h-5.758l-1.44-2.928h-1.4394v26.355z"
|
||||
id="path20" />
|
||||
<rect
|
||||
transform="matrix(8.1756e-8,-1,1,9.5856e-8,0,0)"
|
||||
height="2.8788"
|
||||
width="5.8566"
|
||||
y="32.685"
|
||||
x="-18.276"
|
||||
fill="#ff7800"
|
||||
id="rect22" />
|
||||
<rect
|
||||
transform="matrix(8.1758e-8,-1,1,9.5854e-8,0,0)"
|
||||
height="2.8789"
|
||||
width="5.8566"
|
||||
y="12.534"
|
||||
x="-18.276"
|
||||
fill="#ff7800"
|
||||
id="rect24" />
|
||||
<rect
|
||||
transform="matrix(8.1756e-8,-1,1,9.5856e-8,0,0)"
|
||||
height="2.8788"
|
||||
width="5.8566"
|
||||
y="32.685"
|
||||
x="-27.061"
|
||||
fill="#ff7800"
|
||||
id="rect26" />
|
||||
<rect
|
||||
transform="matrix(8.1758e-8,-1,1,9.5854e-8,0,0)"
|
||||
height="2.8789"
|
||||
width="5.8566"
|
||||
y="12.533"
|
||||
x="-27.061"
|
||||
fill="#ff7800"
|
||||
id="rect28" />
|
||||
<rect
|
||||
transform="matrix(8.1756e-8,-1,1,9.5856e-8,0,0)"
|
||||
height="2.8788"
|
||||
width="5.8566"
|
||||
y="32.685"
|
||||
x="-35.846"
|
||||
fill="#ff7800"
|
||||
id="rect30" />
|
||||
<rect
|
||||
transform="matrix(8.1758e-8,-1,1,9.5854e-8,0,0)"
|
||||
height="2.8789"
|
||||
width="5.8566"
|
||||
y="12.533"
|
||||
x="-35.846"
|
||||
fill="#ff7800"
|
||||
id="rect32" />
|
||||
<path
|
||||
fill="#fff"
|
||||
d="m-0.85801 27.129 0.23831-5.9251 12.955 0.06852v5.8566h-13.193z"
|
||||
id="path34" />
|
||||
<path
|
||||
fill="#fff"
|
||||
d="m-0.42124 43.235 0.91305-5.9251 11.843-7.2522v5.8566l-12.756 7.3207z"
|
||||
id="path36" />
|
||||
<path
|
||||
fill="#fff"
|
||||
d="m48.956 27.129-0.23834-5.9251-12.955 0.06852v5.8566h13.193z"
|
||||
id="path38" />
|
||||
<path
|
||||
fill="#fff"
|
||||
d="m-0.42124 5.1672 0.91305 5.9251 11.843 7.2522v-5.8566l-12.756-7.3198z"
|
||||
id="path40" />
|
||||
<path
|
||||
fill="#fff"
|
||||
d="m48.519 43.235-0.91305-5.9251-11.843-7.2522v5.8566l12.756 7.3207z"
|
||||
id="path42" />
|
||||
<path
|
||||
fill="#fff"
|
||||
d="m48.519 5.1672-0.91305 5.9251-11.843 7.2522v-5.8566l12.756-7.3198z"
|
||||
id="path44" />
|
||||
<path
|
||||
d="m28.849 14.073-7.0793 6.2502h4.5106v7.146h-1.5187v0.03624h-6.5222v-4.3135l-6.4659 6.8457 6.4659 6.8431v-4.3601h8.0409v1.09h0.03751v6.3046h-4.4624l7.082 6.2502 7.0793-6.2502h-4.5106v-7.3946h0.48213v-0.03625h6.5195v4.3135l6.466-6.8457-6.466-6.8431v4.3601h-7.0016v-0.84405h-0.03749v-6.302h4.4624l-7.082-6.2502z"
|
||||
fill-rule="evenodd"
|
||||
stroke="#44a118"
|
||||
stroke-width="1.421"
|
||||
fill="#59d421"
|
||||
id="path62" />
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 4.8 KiB |
|
@ -0,0 +1,106 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
height="26"
|
||||
width="26"
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
inkscape:version="0.48.1 "
|
||||
sodipodi:docname="zone_duplicate.svg">
|
||||
<metadata
|
||||
id="metadata14">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs12" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1280"
|
||||
inkscape:window-height="968"
|
||||
id="namedview10"
|
||||
showgrid="true"
|
||||
inkscape:snap-grids="false"
|
||||
inkscape:snap-to-guides="false"
|
||||
inkscape:zoom="22.045246"
|
||||
inkscape:cx="10.229885"
|
||||
inkscape:cy="17.675012"
|
||||
inkscape:window-x="-4"
|
||||
inkscape:window-y="-4"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid2822"
|
||||
empspacing="5"
|
||||
visible="true"
|
||||
enabled="true"
|
||||
snapvisiblegridlinesonly="true" />
|
||||
</sodipodi:namedview>
|
||||
<g
|
||||
id="g2985"
|
||||
transform="matrix(0.83978077,0,0,0.84815042,-0.69124775,-0.7771573)">
|
||||
<path
|
||||
sodipodi:nodetypes="cccccccc"
|
||||
style="fill:#007d00"
|
||||
id="path6"
|
||||
d="m 11.450509,7.1270774 3.562524,-0.082441 9.990276,10.9576626 c 0.05293,1.047104 -0.0071,1.130791 0.04189,4.064582 l -10.019441,-11.051589 -3.575784,-0.0149 -0.01797,-2.0444647 0.01851,-1.8288549 z"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
sodipodi:nodetypes="csssccsssc"
|
||||
style="fill:#007d00"
|
||||
id="path8"
|
||||
d="M 9.0596737,5.051126 C 6.7778677,5.0151714 5.0156064,6.698637 4.9976291,8.9552772 4.9823952,10.852311 6.687876,12.992986 9.0416964,13.021224 11.215469,13.047302 12.964661,11.28357 12.959922,8.9912318 12.955405,6.8062095 11.233617,5.0151714 9.0596737,5.051126 z M 9.0237193,7.0329386 C 10.273838,7.0149614 11.033723,8.0705407 11.0394,8.9552772 11.047156,10.163971 10.076093,11.024425 9.005742,11.003458 7.8456973,10.980733 7.0234621,10.092348 7.0080391,9.0271864 6.991862,7.8910938 7.8454501,7.0329386 9.0237193,7.0329386 z"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccccsssccccc"
|
||||
style="fill:#007d00;stroke:#294128;stroke-width:0.96542722;stroke-opacity:1"
|
||||
id="path4-9"
|
||||
d="m 1.3839749,1.4472304 0,23.0744796 23.1912591,0 -10.903193,-11.798566 c -1.042023,1.518154 -2.486693,2.082365 -4.6159936,2.186179 -3.3635454,0.163989 -5.7785427,-2.746597 -5.7785427,-5.7896391 0,-3.0430985 1.9598634,-5.6142371 5.8133611,-5.7204292 1.9273672,-0.053119 3.2176012,0.9006426 3.9944692,1.856684 l 2.74503,0 8.704553,9.6893333 c 0.0081,-0.931634 0.04224,-8.0151116 0.03973,-13.4980994 l -23.1906671,5.78e-5 z"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="g3790"
|
||||
transform="translate(-19.961779,-1.0937961)">
|
||||
<path
|
||||
d="m 34.437331,11.785553 3.011811,-0.07087 8.362205,9.283465 c 0.07087,0.92126 0,0.992126 0.03543,3.472441 l -8.397638,-9.389764 -3.011811,0 0,-1.736221 0,-1.559055 z"
|
||||
style="fill:#f91100;fill-opacity:0.68556704;fill-rule:nonzero;stroke:none"
|
||||
id="2"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
d="m 32.417646,10.013899 c -1.913386,0 -3.366142,1.417323 -3.401575,3.330709 0,1.594489 1.417323,3.437008 3.401575,3.437008 1.84252,0.03543 3.295276,-1.452756 3.295276,-3.401575 0,-1.877953 -1.452756,-3.366142 -3.295276,-3.366142 z m 0,1.700788 c 1.027559,-0.03543 1.665354,0.885827 1.665354,1.629921 0.03543,1.027559 -0.779527,1.736221 -1.700787,1.736221 -0.956693,-0.03543 -1.665355,-0.779528 -1.665355,-1.665355 -0.03543,-0.992126 0.708662,-1.700787 1.700788,-1.700787 z"
|
||||
style="fill:#f80100;fill-opacity:0.68041232;fill-rule:nonzero;stroke:none"
|
||||
id="3"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
d="m 25.968827,6.966655 0,19.59449 19.488189,0 -9.141732,-10.02756 c -0.885827,1.27559 -2.090551,1.771654 -3.897638,1.84252 -2.799213,0.141732 -4.854331,-2.30315 -4.854331,-4.889764 0,-2.586615 1.665354,-4.7834654 4.889764,-4.8543315 1.629921,-0.035433 2.692913,0.7440945 3.366142,1.5590555 l 2.303149,0 7.299213,8.220473 c 0,-0.779528 0.03543,-6.80315 0.03543,-11.444883 l -19.488189,0 z"
|
||||
style="fill:#f70300;fill-opacity:0.68556704;fill-rule:nonzero;stroke:#294128;stroke-width:0.7795276px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
id="4"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<path
|
||||
style="fill:#000080;fill-rule:evenodd"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4220"
|
||||
d="m 18.859997,6.2927451 -3.869912,0.040856 5.344997,4.1765139 5.344998,-4.1765139 h -4.008748 c 0,-3.6544494 -1.475086,-5.74270633 -6.820083,-5.74270633 V 3.2012159 c 2.672499,0 4.008748,0.5220642 4.008748,3.0915599 z" />
|
||||
</svg>
|
After Width: | Height: | Size: 5.4 KiB |
|
@ -121,6 +121,8 @@ set(PCB_COMMON_SRCS
|
|||
../pcbnew/legacy_plugin.cpp
|
||||
../pcbnew/kicad_plugin.cpp
|
||||
pcb_plot_params_keywords.cpp
|
||||
pcb_keywords.cpp
|
||||
../pcbnew/pcb_parser.cpp
|
||||
)
|
||||
|
||||
|
||||
|
@ -148,6 +150,14 @@ make_lexer(
|
|||
PCBPLOTPARAMS_T
|
||||
)
|
||||
|
||||
# auto-generate pcbnew_sexpr.h and pcbnew_sexpr.cpp
|
||||
make_lexer( ${CMAKE_CURRENT_SOURCE_DIR}/pcb.keywords
|
||||
${PROJECT_SOURCE_DIR}/include/pcb_lexer.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/pcb_keywords.cpp
|
||||
PCB
|
||||
)
|
||||
|
||||
|
||||
# The dsntest may not build properly using MS Visual Studio.
|
||||
if(NOT MSVC)
|
||||
# This one gets made only when testing.
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
@ -285,7 +286,7 @@ GRID_TYPE& BASE_SCREEN::GetGrid( size_t aIndex )
|
|||
}
|
||||
|
||||
|
||||
wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition,
|
||||
wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition,
|
||||
wxRealPoint* aGridSize ) const
|
||||
{
|
||||
wxPoint pt;
|
||||
|
|
|
@ -3,6 +3,30 @@
|
|||
* @brief Kicad: Common plot PDF Routines
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2012 Lorenzo Marcantonio, l.marcantonio@logossrl.com
|
||||
* Copyright (C) 1992-2012 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
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <trigo.h>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
/* Plot sheet references
|
||||
* margin is in mils (1/1000 inch)
|
||||
*/
|
||||
void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
|
||||
void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen, int aLineWidth )
|
||||
{
|
||||
#define WSTEXTSIZE 50 // Text size in mils
|
||||
|
||||
|
@ -46,10 +46,11 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
|
|||
#endif
|
||||
|
||||
bool italic = false;
|
||||
bool thickness = 0; //@todo : use current pen
|
||||
int thickness = aLineWidth;
|
||||
|
||||
color = BLACK;
|
||||
plotter->SetColor( color );
|
||||
plotter->SetCurrentLineWidth( thickness );
|
||||
|
||||
// Plot edge.
|
||||
ref.x = pageInfo.GetLeftMarginMils() * iusPerMil;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -83,7 +83,7 @@ END_EVENT_TABLE()
|
|||
|
||||
EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
|
||||
const wxPoint& pos, const wxSize& size ) :
|
||||
wxScrolledWindow( parent, id, pos, size, wxBORDER | wxHSCROLL | wxVSCROLL )
|
||||
wxScrolledWindow( parent, id, pos, size, wxBORDER | wxHSCROLL | wxVSCROLL | wxALWAYS_SHOW_SB )
|
||||
{
|
||||
wxASSERT( parent );
|
||||
|
||||
|
|
|
@ -2,6 +2,33 @@
|
|||
* Functions to draw and plot text on screen
|
||||
* @file drawtxt.cpp
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <gr_basic.h>
|
||||
#include <common.h>
|
||||
|
@ -526,15 +553,17 @@ void PLOTTER::Text( const wxPoint& aPos,
|
|||
bool aItalic,
|
||||
bool aBold )
|
||||
{
|
||||
if( aWidth == 0 && aBold ) // Use default values if aWidth == 0
|
||||
aWidth = GetPenSizeForBold( MIN( aSize.x, aSize.y ) );
|
||||
int textPensize = aWidth;
|
||||
|
||||
if( aWidth >= 0 )
|
||||
aWidth = Clamp_Text_PenSize( aWidth, aSize, aBold );
|
||||
if( textPensize == 0 && aBold ) // Use default values if aWidth == 0
|
||||
textPensize = GetPenSizeForBold( MIN( aSize.x, aSize.y ) );
|
||||
|
||||
if( textPensize >= 0 )
|
||||
textPensize = Clamp_Text_PenSize( aWidth, aSize, aBold );
|
||||
else
|
||||
aWidth = -Clamp_Text_PenSize( -aWidth, aSize, aBold );
|
||||
textPensize = -Clamp_Text_PenSize( -aWidth, aSize, aBold );
|
||||
|
||||
SetCurrentLineWidth( aWidth );
|
||||
SetCurrentLineWidth( textPensize );
|
||||
|
||||
|
||||
if( aColor >= 0 )
|
||||
|
@ -543,8 +572,11 @@ void PLOTTER::Text( const wxPoint& aPos,
|
|||
DrawGraphicText( NULL, NULL, aPos, aColor, aText,
|
||||
aOrient, aSize,
|
||||
aH_justify, aV_justify,
|
||||
aWidth, aItalic,
|
||||
textPensize, aItalic,
|
||||
aBold,
|
||||
NULL,
|
||||
this );
|
||||
|
||||
if( aWidth != textPensize )
|
||||
SetCurrentLineWidth( aWidth );
|
||||
}
|
||||
|
|
|
@ -374,8 +374,13 @@ int DSNLEXER::NeedNUMBER( const char* aExpectation ) throw( IO_ERROR )
|
|||
*/
|
||||
static inline bool isSpace( int cc )
|
||||
{
|
||||
// make sure int passed to ::isspace() is 0-255
|
||||
return ::isspace( cc & 0xff );
|
||||
// Warning: we are using UTF8 char, so values are coded from 0x01 to 0xFF
|
||||
// isspace( int value ) works fine under Linux,
|
||||
// but seems use only a 7 bits value under mingw, in comparisons.
|
||||
// (for instance 0xA0 is seen as 0x20)
|
||||
// So we need to test if the value is ASCII ( <= 127) and a space ( ' ', \t, \n ... )
|
||||
// and not just a space:
|
||||
return ( (unsigned) cc <= 127 ) && ::isspace( cc );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,391 +1,395 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file eda_text.cpp
|
||||
* @brief Implementation of base KiCad text object.
|
||||
*/
|
||||
|
||||
#include <eda_text.h>
|
||||
#include <drawtxt.h>
|
||||
#include <macros.h> // MAX
|
||||
#include <trigo.h> // RotatePoint
|
||||
#include <class_drawpanel.h> // EDA_DRAW_PANEL
|
||||
|
||||
|
||||
// Conversion to application internal units defined at build time.
|
||||
#if defined( PCBNEW )
|
||||
#include <class_board_item.h>
|
||||
#define MILS_TO_IU( x ) ( x * IU_PER_MILS );
|
||||
#elif defined( EESCHEMA )
|
||||
#include <sch_item_struct.h>
|
||||
#define MILS_TO_IU( x ) ( x )
|
||||
#else
|
||||
#error "Cannot resolve units formatting due to no definition of EESCHEMA or PCBNEW."
|
||||
#endif
|
||||
|
||||
|
||||
EDA_TEXT::EDA_TEXT( const wxString& text )
|
||||
{
|
||||
m_Size.x = m_Size.y = MILS_TO_IU( DEFAULT_SIZE_TEXT ); // Width and height of font.
|
||||
m_Orient = 0; // Rotation angle in 0.1 degrees.
|
||||
m_Attributs = 0;
|
||||
m_Mirror = false; // display mirror if true
|
||||
m_HJustify = GR_TEXT_HJUSTIFY_CENTER; // Default horizontal justification is centered.
|
||||
m_VJustify = GR_TEXT_VJUSTIFY_CENTER; // Default vertical justification is centered.
|
||||
m_Thickness = 0; // thickness
|
||||
m_Italic = false; // true = italic shape.
|
||||
m_Bold = false;
|
||||
m_MultilineAllowed = false; // Set to true for multiline text.
|
||||
m_Text = text;
|
||||
}
|
||||
|
||||
|
||||
EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText )
|
||||
{
|
||||
m_Pos = aText.m_Pos;
|
||||
m_Size = aText.m_Size;
|
||||
m_Orient = aText.m_Orient;
|
||||
m_Attributs = aText.m_Attributs;
|
||||
m_Mirror = aText.m_Mirror;
|
||||
m_HJustify = aText.m_HJustify;
|
||||
m_VJustify = aText.m_VJustify;
|
||||
m_Thickness = aText.m_Thickness;
|
||||
m_Italic = aText.m_Italic;
|
||||
m_Bold = aText.m_Bold;
|
||||
m_MultilineAllowed = aText.m_MultilineAllowed;
|
||||
m_Text = aText.m_Text;
|
||||
}
|
||||
|
||||
|
||||
EDA_TEXT::~EDA_TEXT()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int EDA_TEXT::LenSize( const wxString& aLine ) const
|
||||
{
|
||||
return ReturnGraphicTextWidth( aLine, m_Size.x, m_Italic, m_Bold );
|
||||
}
|
||||
|
||||
|
||||
EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
|
||||
{
|
||||
EDA_RECT rect;
|
||||
wxPoint pos;
|
||||
wxArrayString* list = NULL;
|
||||
wxString text = m_Text;
|
||||
int thickness = ( aThickness < 0 ) ? m_Thickness : aThickness;
|
||||
|
||||
if( m_MultilineAllowed )
|
||||
{
|
||||
list = wxStringSplit( m_Text, '\n' );
|
||||
|
||||
if ( list->GetCount() ) // GetCount() == 0 for void strings
|
||||
{
|
||||
if( aLine >= 0 && (aLine < (int)list->GetCount()) )
|
||||
text = list->Item( aLine );
|
||||
else
|
||||
text = list->Item( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
// calculate the H and V size
|
||||
int dx = LenSize( text );
|
||||
int dy = GetInterline();
|
||||
|
||||
/* Creates bounding box (rectangle) for an horizontal text */
|
||||
wxSize textsize = wxSize( dx, dy );
|
||||
|
||||
if( aInvertY )
|
||||
rect.SetOrigin( m_Pos.x, -m_Pos.y );
|
||||
else
|
||||
rect.SetOrigin( m_Pos );
|
||||
|
||||
// extra dy interval for letters like j and y and ]
|
||||
int extra_dy = dy - m_Size.y;
|
||||
rect.Move( wxPoint( 0, -extra_dy / 2 ) ); // move origin by the half extra interval
|
||||
|
||||
// for multiline texts and aLine < 0, merge all rectangles
|
||||
if( m_MultilineAllowed && list && aLine < 0 )
|
||||
{
|
||||
for( unsigned ii = 1; ii < list->GetCount(); ii++ )
|
||||
{
|
||||
text = list->Item( ii );
|
||||
dx = LenSize( text );
|
||||
textsize.x = MAX( textsize.x, dx );
|
||||
textsize.y += dy;
|
||||
}
|
||||
}
|
||||
|
||||
delete list;
|
||||
|
||||
rect.SetSize( textsize );
|
||||
|
||||
/* Now, calculate the rect origin, according to text justification
|
||||
* At this point the rectangle origin is the text origin (m_Pos).
|
||||
* This is true only for left and top text justified texts (using top to bottom Y axis
|
||||
* orientation). and must be recalculated for others justifications
|
||||
* also, note the V justification is relative to the first line
|
||||
*/
|
||||
switch( m_HJustify )
|
||||
{
|
||||
case GR_TEXT_HJUSTIFY_LEFT:
|
||||
if( m_Mirror )
|
||||
rect.SetX( rect.GetX() - rect.GetWidth() );
|
||||
break;
|
||||
|
||||
case GR_TEXT_HJUSTIFY_CENTER:
|
||||
rect.SetX( rect.GetX() - (rect.GetWidth() / 2) );
|
||||
break;
|
||||
|
||||
case GR_TEXT_HJUSTIFY_RIGHT:
|
||||
if( !m_Mirror )
|
||||
rect.SetX( rect.GetX() - rect.GetWidth() );
|
||||
break;
|
||||
}
|
||||
|
||||
dy = m_Size.y + thickness;
|
||||
|
||||
switch( m_VJustify )
|
||||
{
|
||||
case GR_TEXT_VJUSTIFY_TOP:
|
||||
break;
|
||||
|
||||
case GR_TEXT_VJUSTIFY_CENTER:
|
||||
rect.SetY( rect.GetY() - (dy / 2) );
|
||||
break;
|
||||
|
||||
case GR_TEXT_VJUSTIFY_BOTTOM:
|
||||
rect.SetY( rect.GetY() - dy );
|
||||
break;
|
||||
}
|
||||
|
||||
rect.Inflate( thickness / 2 );
|
||||
rect.Normalize(); // Make h and v sizes always >= 0
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
||||
bool EDA_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT rect = GetTextBox( -1 ); // Get the full text area.
|
||||
wxPoint location = aPoint;
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
RotatePoint( &location, m_Pos, -m_Orient );
|
||||
|
||||
return rect.Contains( location );
|
||||
}
|
||||
|
||||
|
||||
bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT rect = aRect;
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
|
||||
if( aContains )
|
||||
return rect.Contains( GetTextBox( -1 ) );
|
||||
|
||||
return rect.Intersects( GetTextBox( -1 ) );
|
||||
}
|
||||
|
||||
|
||||
void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
|
||||
EDA_COLOR_T aColor, int aDrawMode,
|
||||
EDA_DRAW_MODE_T aFillMode, EDA_COLOR_T aAnchor_color )
|
||||
{
|
||||
if( m_MultilineAllowed )
|
||||
{
|
||||
wxPoint pos = m_Pos;
|
||||
wxArrayString* list = wxStringSplit( m_Text, '\n' );
|
||||
wxPoint offset;
|
||||
|
||||
offset.y = GetInterline();
|
||||
|
||||
RotatePoint( &offset, m_Orient );
|
||||
|
||||
for( unsigned i = 0; i<list->Count(); i++ )
|
||||
{
|
||||
wxString txt = list->Item( i );
|
||||
DrawOneLineOfText( aPanel,
|
||||
aDC,
|
||||
aOffset,
|
||||
aColor,
|
||||
aDrawMode,
|
||||
aFillMode,
|
||||
i ? UNSPECIFIED : aAnchor_color,
|
||||
txt,
|
||||
pos );
|
||||
pos += offset;
|
||||
}
|
||||
|
||||
delete (list);
|
||||
}
|
||||
else
|
||||
DrawOneLineOfText( aPanel,
|
||||
aDC,
|
||||
aOffset,
|
||||
aColor,
|
||||
aDrawMode,
|
||||
aFillMode,
|
||||
aAnchor_color,
|
||||
m_Text,
|
||||
m_Pos );
|
||||
}
|
||||
|
||||
|
||||
void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||
const wxPoint& aOffset, EDA_COLOR_T aColor,
|
||||
int aDrawMode, EDA_DRAW_MODE_T aFillMode,
|
||||
EDA_COLOR_T aAnchor_color,
|
||||
wxString& aText, wxPoint aPos )
|
||||
{
|
||||
int width = m_Thickness;
|
||||
|
||||
if( aFillMode == LINE )
|
||||
width = 0;
|
||||
|
||||
if( aDrawMode != -1 )
|
||||
GRSetDrawMode( aDC, aDrawMode );
|
||||
|
||||
/* Draw text anchor, if allowed */
|
||||
if( aAnchor_color != UNSPECIFIED )
|
||||
{
|
||||
|
||||
int anchor_size = aDC->DeviceToLogicalXRel( 2 );
|
||||
|
||||
aAnchor_color = (EDA_COLOR_T) ( aAnchor_color & MASKCOLOR );
|
||||
|
||||
int cX = aPos.x + aOffset.x;
|
||||
int cY = aPos.y + aOffset.y;
|
||||
|
||||
GRLine( aPanel->GetClipBox(), aDC, cX - anchor_size, cY,
|
||||
cX + anchor_size, cY, 0, aAnchor_color );
|
||||
|
||||
GRLine( aPanel->GetClipBox(), aDC, cX, cY - anchor_size,
|
||||
cX, cY + anchor_size, 0, aAnchor_color );
|
||||
}
|
||||
|
||||
if( aFillMode == SKETCH )
|
||||
width = -width;
|
||||
|
||||
wxSize size = m_Size;
|
||||
|
||||
if( m_Mirror )
|
||||
size.x = -size.x;
|
||||
|
||||
DrawGraphicText( aPanel, aDC, aOffset + aPos, aColor, aText, m_Orient, size,
|
||||
m_HJustify, m_VJustify, width, m_Italic, m_Bold );
|
||||
}
|
||||
|
||||
|
||||
wxString EDA_TEXT::GetTextStyleName()
|
||||
{
|
||||
int style = 0;
|
||||
|
||||
if( m_Italic )
|
||||
style = 1;
|
||||
|
||||
if( m_Bold )
|
||||
style += 2;
|
||||
|
||||
wxString stylemsg[4] = {
|
||||
_("Normal"),
|
||||
_("Italic"),
|
||||
_("Bold"),
|
||||
_("Bold+Italic")
|
||||
};
|
||||
|
||||
return stylemsg[style];
|
||||
}
|
||||
|
||||
|
||||
bool EDA_TEXT::IsDefaultFormatting() const
|
||||
{
|
||||
return ( ( m_Size.x == DEFAULT_SIZE_TEXT )
|
||||
&& ( m_Size.y == DEFAULT_SIZE_TEXT )
|
||||
&& ( m_Attributs == 0 )
|
||||
&& ( m_Mirror == false )
|
||||
&& ( m_HJustify == GR_TEXT_HJUSTIFY_CENTER )
|
||||
&& ( m_VJustify == GR_TEXT_VJUSTIFY_CENTER )
|
||||
&& ( m_Thickness == 0 )
|
||||
&& ( m_Italic == false )
|
||||
&& ( m_Bold == false )
|
||||
&& ( m_MultilineAllowed == false ) );
|
||||
}
|
||||
|
||||
|
||||
void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
if( !IsDefaultFormatting() )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+1, "(effects\n" );
|
||||
|
||||
if( ( m_Size.x != DEFAULT_SIZE_TEXT ) || ( m_Size.y != DEFAULT_SIZE_TEXT ) || m_Bold
|
||||
|| m_Italic )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+2, "(font" );
|
||||
|
||||
// Add font support here at some point in the future.
|
||||
|
||||
if( ( m_Size.x != DEFAULT_SIZE_TEXT ) || ( m_Size.y != DEFAULT_SIZE_TEXT ) )
|
||||
aFormatter->Print( 0, " (size %s)", FMT_IU( m_Size ).c_str() );
|
||||
|
||||
if( m_Bold )
|
||||
aFormatter->Print( 0, " bold" );
|
||||
|
||||
if( m_Bold )
|
||||
aFormatter->Print( 0, " italic" );
|
||||
|
||||
aFormatter->Print( 0, ")\n");
|
||||
}
|
||||
|
||||
if( m_Mirror || ( m_HJustify != GR_TEXT_HJUSTIFY_CENTER )
|
||||
|| ( m_VJustify != GR_TEXT_VJUSTIFY_CENTER ) )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+2, "(justify");
|
||||
|
||||
if( m_HJustify != GR_TEXT_HJUSTIFY_CENTER )
|
||||
aFormatter->Print( 0, (m_HJustify == GR_TEXT_HJUSTIFY_LEFT) ? " left" : " right" );
|
||||
|
||||
if( m_VJustify != GR_TEXT_VJUSTIFY_CENTER )
|
||||
aFormatter->Print( 0, (m_VJustify == GR_TEXT_VJUSTIFY_TOP) ? " top" : " bottom" );
|
||||
|
||||
if( m_Mirror )
|
||||
aFormatter->Print( 0, " mirror" );
|
||||
|
||||
aFormatter->Print( 0, ")\n" );
|
||||
}
|
||||
|
||||
// As of now the only place this is used is in Eeschema to hide or show the text.
|
||||
if( m_Attributs )
|
||||
aFormatter->Print( aNestLevel+2, "hide\n" );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, ")\n" );
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file eda_text.cpp
|
||||
* @brief Implementation of base KiCad text object.
|
||||
*/
|
||||
|
||||
#include <eda_text.h>
|
||||
#include <drawtxt.h>
|
||||
#include <macros.h> // MAX
|
||||
#include <trigo.h> // RotatePoint
|
||||
#include <class_drawpanel.h> // EDA_DRAW_PANEL
|
||||
|
||||
|
||||
// Conversion to application internal units defined at build time.
|
||||
#if defined( PCBNEW )
|
||||
#include <class_board_item.h>
|
||||
#define MILS_TO_IU( x ) ( x * IU_PER_MILS );
|
||||
#elif defined( EESCHEMA )
|
||||
#include <sch_item_struct.h>
|
||||
#define MILS_TO_IU( x ) ( x )
|
||||
#else
|
||||
#error "Cannot resolve units formatting due to no definition of EESCHEMA or PCBNEW."
|
||||
#endif
|
||||
|
||||
|
||||
EDA_TEXT::EDA_TEXT( const wxString& text )
|
||||
{
|
||||
m_Size.x = m_Size.y = MILS_TO_IU( DEFAULT_SIZE_TEXT ); // Width and height of font.
|
||||
m_Orient = 0; // Rotation angle in 0.1 degrees.
|
||||
m_Attributs = 0;
|
||||
m_Mirror = false; // display mirror if true
|
||||
m_HJustify = GR_TEXT_HJUSTIFY_CENTER; // Default horizontal justification is centered.
|
||||
m_VJustify = GR_TEXT_VJUSTIFY_CENTER; // Default vertical justification is centered.
|
||||
m_Thickness = 0; // thickness
|
||||
m_Italic = false; // true = italic shape.
|
||||
m_Bold = false;
|
||||
m_MultilineAllowed = false; // Set to true for multiline text.
|
||||
m_Text = text;
|
||||
}
|
||||
|
||||
|
||||
EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText )
|
||||
{
|
||||
m_Pos = aText.m_Pos;
|
||||
m_Size = aText.m_Size;
|
||||
m_Orient = aText.m_Orient;
|
||||
m_Attributs = aText.m_Attributs;
|
||||
m_Mirror = aText.m_Mirror;
|
||||
m_HJustify = aText.m_HJustify;
|
||||
m_VJustify = aText.m_VJustify;
|
||||
m_Thickness = aText.m_Thickness;
|
||||
m_Italic = aText.m_Italic;
|
||||
m_Bold = aText.m_Bold;
|
||||
m_MultilineAllowed = aText.m_MultilineAllowed;
|
||||
m_Text = aText.m_Text;
|
||||
}
|
||||
|
||||
|
||||
EDA_TEXT::~EDA_TEXT()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int EDA_TEXT::LenSize( const wxString& aLine ) const
|
||||
{
|
||||
return ReturnGraphicTextWidth( aLine, m_Size.x, m_Italic, m_Bold );
|
||||
}
|
||||
|
||||
|
||||
EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
|
||||
{
|
||||
EDA_RECT rect;
|
||||
wxPoint pos;
|
||||
wxArrayString* list = NULL;
|
||||
wxString text = m_Text;
|
||||
int thickness = ( aThickness < 0 ) ? m_Thickness : aThickness;
|
||||
|
||||
if( m_MultilineAllowed )
|
||||
{
|
||||
list = wxStringSplit( m_Text, '\n' );
|
||||
|
||||
if ( list->GetCount() ) // GetCount() == 0 for void strings
|
||||
{
|
||||
if( aLine >= 0 && (aLine < (int)list->GetCount()) )
|
||||
text = list->Item( aLine );
|
||||
else
|
||||
text = list->Item( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
// calculate the H and V size
|
||||
int dx = LenSize( text );
|
||||
int dy = GetInterline();
|
||||
|
||||
/* Creates bounding box (rectangle) for an horizontal text */
|
||||
wxSize textsize = wxSize( dx, dy );
|
||||
|
||||
if( aInvertY )
|
||||
rect.SetOrigin( m_Pos.x, -m_Pos.y );
|
||||
else
|
||||
rect.SetOrigin( m_Pos );
|
||||
|
||||
// extra dy interval for letters like j and y and ]
|
||||
int extra_dy = dy - m_Size.y;
|
||||
rect.Move( wxPoint( 0, -extra_dy / 2 ) ); // move origin by the half extra interval
|
||||
|
||||
// for multiline texts and aLine < 0, merge all rectangles
|
||||
if( m_MultilineAllowed && list && aLine < 0 )
|
||||
{
|
||||
for( unsigned ii = 1; ii < list->GetCount(); ii++ )
|
||||
{
|
||||
text = list->Item( ii );
|
||||
dx = LenSize( text );
|
||||
textsize.x = MAX( textsize.x, dx );
|
||||
textsize.y += dy;
|
||||
}
|
||||
}
|
||||
|
||||
delete list;
|
||||
|
||||
rect.SetSize( textsize );
|
||||
|
||||
/* Now, calculate the rect origin, according to text justification
|
||||
* At this point the rectangle origin is the text origin (m_Pos).
|
||||
* This is true only for left and top text justified texts (using top to bottom Y axis
|
||||
* orientation). and must be recalculated for others justifications
|
||||
* also, note the V justification is relative to the first line
|
||||
*/
|
||||
switch( m_HJustify )
|
||||
{
|
||||
case GR_TEXT_HJUSTIFY_LEFT:
|
||||
if( m_Mirror )
|
||||
rect.SetX( rect.GetX() - rect.GetWidth() );
|
||||
break;
|
||||
|
||||
case GR_TEXT_HJUSTIFY_CENTER:
|
||||
rect.SetX( rect.GetX() - (rect.GetWidth() / 2) );
|
||||
break;
|
||||
|
||||
case GR_TEXT_HJUSTIFY_RIGHT:
|
||||
if( !m_Mirror )
|
||||
rect.SetX( rect.GetX() - rect.GetWidth() );
|
||||
break;
|
||||
}
|
||||
|
||||
dy = m_Size.y + thickness;
|
||||
|
||||
switch( m_VJustify )
|
||||
{
|
||||
case GR_TEXT_VJUSTIFY_TOP:
|
||||
break;
|
||||
|
||||
case GR_TEXT_VJUSTIFY_CENTER:
|
||||
rect.SetY( rect.GetY() - (dy / 2) );
|
||||
break;
|
||||
|
||||
case GR_TEXT_VJUSTIFY_BOTTOM:
|
||||
rect.SetY( rect.GetY() - dy );
|
||||
break;
|
||||
}
|
||||
|
||||
rect.Inflate( thickness / 2 );
|
||||
rect.Normalize(); // Make h and v sizes always >= 0
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
||||
bool EDA_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT rect = GetTextBox( -1 ); // Get the full text area.
|
||||
wxPoint location = aPoint;
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
RotatePoint( &location, m_Pos, -m_Orient );
|
||||
|
||||
return rect.Contains( location );
|
||||
}
|
||||
|
||||
|
||||
bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT rect = aRect;
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
|
||||
if( aContains )
|
||||
return rect.Contains( GetTextBox( -1 ) );
|
||||
|
||||
return rect.Intersects( GetTextBox( -1 ) );
|
||||
}
|
||||
|
||||
|
||||
void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
|
||||
EDA_COLOR_T aColor, int aDrawMode,
|
||||
EDA_DRAW_MODE_T aFillMode, EDA_COLOR_T aAnchor_color )
|
||||
{
|
||||
if( m_MultilineAllowed )
|
||||
{
|
||||
wxPoint pos = m_Pos;
|
||||
wxArrayString* list = wxStringSplit( m_Text, '\n' );
|
||||
wxPoint offset;
|
||||
|
||||
offset.y = GetInterline();
|
||||
|
||||
RotatePoint( &offset, m_Orient );
|
||||
|
||||
for( unsigned i = 0; i<list->Count(); i++ )
|
||||
{
|
||||
wxString txt = list->Item( i );
|
||||
DrawOneLineOfText( aPanel,
|
||||
aDC,
|
||||
aOffset,
|
||||
aColor,
|
||||
aDrawMode,
|
||||
aFillMode,
|
||||
i ? UNSPECIFIED : aAnchor_color,
|
||||
txt,
|
||||
pos );
|
||||
pos += offset;
|
||||
}
|
||||
|
||||
delete (list);
|
||||
}
|
||||
else
|
||||
DrawOneLineOfText( aPanel,
|
||||
aDC,
|
||||
aOffset,
|
||||
aColor,
|
||||
aDrawMode,
|
||||
aFillMode,
|
||||
aAnchor_color,
|
||||
m_Text,
|
||||
m_Pos );
|
||||
}
|
||||
|
||||
|
||||
void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||
const wxPoint& aOffset, EDA_COLOR_T aColor,
|
||||
int aDrawMode, EDA_DRAW_MODE_T aFillMode,
|
||||
EDA_COLOR_T aAnchor_color,
|
||||
wxString& aText, wxPoint aPos )
|
||||
{
|
||||
int width = m_Thickness;
|
||||
|
||||
if( aFillMode == LINE )
|
||||
width = 0;
|
||||
|
||||
if( aDrawMode != -1 )
|
||||
GRSetDrawMode( aDC, aDrawMode );
|
||||
|
||||
/* Draw text anchor, if allowed */
|
||||
if( aAnchor_color != UNSPECIFIED )
|
||||
{
|
||||
|
||||
int anchor_size = aDC->DeviceToLogicalXRel( 2 );
|
||||
|
||||
aAnchor_color = (EDA_COLOR_T) ( aAnchor_color & MASKCOLOR );
|
||||
|
||||
int cX = aPos.x + aOffset.x;
|
||||
int cY = aPos.y + aOffset.y;
|
||||
|
||||
GRLine( aPanel->GetClipBox(), aDC, cX - anchor_size, cY,
|
||||
cX + anchor_size, cY, 0, aAnchor_color );
|
||||
|
||||
GRLine( aPanel->GetClipBox(), aDC, cX, cY - anchor_size,
|
||||
cX, cY + anchor_size, 0, aAnchor_color );
|
||||
}
|
||||
|
||||
if( aFillMode == SKETCH )
|
||||
width = -width;
|
||||
|
||||
wxSize size = m_Size;
|
||||
|
||||
if( m_Mirror )
|
||||
size.x = -size.x;
|
||||
|
||||
DrawGraphicText( aPanel, aDC, aOffset + aPos, aColor, aText, m_Orient, size,
|
||||
m_HJustify, m_VJustify, width, m_Italic, m_Bold );
|
||||
}
|
||||
|
||||
|
||||
wxString EDA_TEXT::GetTextStyleName()
|
||||
{
|
||||
int style = 0;
|
||||
|
||||
if( m_Italic )
|
||||
style = 1;
|
||||
|
||||
if( m_Bold )
|
||||
style += 2;
|
||||
|
||||
wxString stylemsg[4] = {
|
||||
_("Normal"),
|
||||
_("Italic"),
|
||||
_("Bold"),
|
||||
_("Bold+Italic")
|
||||
};
|
||||
|
||||
return stylemsg[style];
|
||||
}
|
||||
|
||||
|
||||
bool EDA_TEXT::IsDefaultFormatting() const
|
||||
{
|
||||
return ( ( m_Size.x == DEFAULT_SIZE_TEXT )
|
||||
&& ( m_Size.y == DEFAULT_SIZE_TEXT )
|
||||
&& ( m_Attributs == 0 )
|
||||
&& ( m_Mirror == false )
|
||||
&& ( m_HJustify == GR_TEXT_HJUSTIFY_CENTER )
|
||||
&& ( m_VJustify == GR_TEXT_VJUSTIFY_CENTER )
|
||||
&& ( m_Thickness == 0 )
|
||||
&& ( m_Italic == false )
|
||||
&& ( m_Bold == false )
|
||||
&& ( m_MultilineAllowed == false ) );
|
||||
}
|
||||
|
||||
|
||||
void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
if( !IsDefaultFormatting() )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+1, "(effects\n" );
|
||||
|
||||
if( ( m_Size.x != DEFAULT_SIZE_TEXT ) || ( m_Size.y != DEFAULT_SIZE_TEXT ) || m_Bold
|
||||
|| m_Italic )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+2, "(font" );
|
||||
|
||||
// Add font support here at some point in the future.
|
||||
|
||||
if( ( m_Size.x != DEFAULT_SIZE_TEXT ) || ( m_Size.y != DEFAULT_SIZE_TEXT ) )
|
||||
aFormatter->Print( 0, " (size %s %s)", FMT_IU( m_Size.GetHeight() ).c_str(),
|
||||
FMT_IU( m_Size.GetWidth() ).c_str() );
|
||||
|
||||
if( m_Thickness != 0 )
|
||||
aFormatter->Print( 0, " (thickness %s)", FMT_IU( GetThickness() ).c_str() );
|
||||
|
||||
if( m_Bold )
|
||||
aFormatter->Print( 0, " bold" );
|
||||
|
||||
if( IsItalic() )
|
||||
aFormatter->Print( 0, " italic" );
|
||||
|
||||
aFormatter->Print( 0, ")\n");
|
||||
}
|
||||
|
||||
if( m_Mirror || ( m_HJustify != GR_TEXT_HJUSTIFY_CENTER )
|
||||
|| ( m_VJustify != GR_TEXT_VJUSTIFY_CENTER ) )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+2, "(justify");
|
||||
|
||||
if( m_HJustify != GR_TEXT_HJUSTIFY_CENTER )
|
||||
aFormatter->Print( 0, (m_HJustify == GR_TEXT_HJUSTIFY_LEFT) ? " left" : " right" );
|
||||
|
||||
if( m_VJustify != GR_TEXT_VJUSTIFY_CENTER )
|
||||
aFormatter->Print( 0, (m_VJustify == GR_TEXT_VJUSTIFY_TOP) ? " top" : " bottom" );
|
||||
|
||||
if( m_Mirror )
|
||||
aFormatter->Print( 0, " mirror" );
|
||||
|
||||
aFormatter->Print( 0, ")\n" );
|
||||
}
|
||||
|
||||
// As of now the only place this is used is in Eeschema to hide or show the text.
|
||||
if( m_Attributs )
|
||||
aFormatter->Print( aNestLevel+2, "hide\n" );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, ")\n" );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,196 @@
|
|||
#
|
||||
# This program source code file is part of KiCad, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2012 CERN.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
# These are the keywords for the Pcbnew s-expression file format.
|
||||
|
||||
add_net
|
||||
angle
|
||||
arc
|
||||
arc_segments
|
||||
area
|
||||
arrow1a
|
||||
arrow1b
|
||||
arrow2a
|
||||
arrow2b
|
||||
at
|
||||
attr
|
||||
autoplace_cost90
|
||||
autoplace_cost180
|
||||
aux_axis_origin
|
||||
blind
|
||||
bold
|
||||
bottom
|
||||
center
|
||||
chamfer
|
||||
circle
|
||||
clearance
|
||||
comment
|
||||
company
|
||||
connect
|
||||
connect_pads
|
||||
crossbar
|
||||
date
|
||||
descr
|
||||
die_length
|
||||
dimension
|
||||
drawings
|
||||
drill
|
||||
edge
|
||||
edge_width
|
||||
effects
|
||||
end
|
||||
feature1
|
||||
feature2
|
||||
fill
|
||||
fill_segments
|
||||
filled_polygon
|
||||
fillet
|
||||
font
|
||||
fp_arc
|
||||
fp_circle
|
||||
fp_curve
|
||||
fp_line
|
||||
fp_poly
|
||||
fp_text
|
||||
full
|
||||
general
|
||||
gr_arc
|
||||
gr_circle
|
||||
gr_curve
|
||||
gr_line
|
||||
gr_poly
|
||||
gr_text
|
||||
hatch
|
||||
hide
|
||||
italic
|
||||
justify
|
||||
kicad_pcb
|
||||
last_trace_width
|
||||
layer
|
||||
layers
|
||||
left
|
||||
links
|
||||
locked
|
||||
micro
|
||||
min_thickness
|
||||
mirror
|
||||
mod_edge_width
|
||||
mod_text_size
|
||||
mod_text_width
|
||||
mode
|
||||
model
|
||||
module
|
||||
net
|
||||
net_class
|
||||
net_name
|
||||
nets
|
||||
no
|
||||
no_connects
|
||||
none
|
||||
np_thru_hole
|
||||
offset
|
||||
oval
|
||||
pad
|
||||
pad_drill
|
||||
pad_size
|
||||
pad_to_mask_clearance
|
||||
pad_to_paste_clearance
|
||||
pad_to_paste_clearance_ratio
|
||||
page
|
||||
path
|
||||
pcb_text_size
|
||||
pcb_text_width
|
||||
pcbplotparams
|
||||
placed
|
||||
plus
|
||||
polygon
|
||||
portrait
|
||||
priority
|
||||
pts
|
||||
radius
|
||||
rev
|
||||
rect
|
||||
rect_delta
|
||||
reference
|
||||
right
|
||||
rotate
|
||||
scale
|
||||
segment
|
||||
segment_width
|
||||
setup
|
||||
size
|
||||
smd
|
||||
smoothing
|
||||
solder_mask_margin
|
||||
solder_paste_margin
|
||||
solder_paste_margin_ratio
|
||||
solder_paste_ratio
|
||||
start
|
||||
status
|
||||
tags
|
||||
target
|
||||
title
|
||||
title_block
|
||||
tedit
|
||||
thermal_width
|
||||
thermal_gap
|
||||
thermal_bridge_width
|
||||
thickness
|
||||
top
|
||||
trace_width
|
||||
tracks
|
||||
trace_min
|
||||
trace_clearance
|
||||
trapezoid
|
||||
thru
|
||||
thru_hole
|
||||
tstamp
|
||||
user
|
||||
user_trace_width
|
||||
user_via
|
||||
uvia_dia
|
||||
uvia_drill
|
||||
uvia_min_drill
|
||||
uvia_min_size
|
||||
uvia_size
|
||||
uvias_allowed
|
||||
value
|
||||
version
|
||||
via
|
||||
via_dia
|
||||
via_drill
|
||||
via_min_drill
|
||||
via_min_size
|
||||
via_size
|
||||
virtual
|
||||
visible_elements
|
||||
width
|
||||
x
|
||||
xy
|
||||
xyz
|
||||
yes
|
||||
zone
|
||||
zone_45_only
|
||||
zone_clearance
|
||||
zone_connect
|
||||
zones
|
|
@ -1673,28 +1673,36 @@ void TITLE_BLOCK::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCont
|
|||
aFormatter->Print( aNestLevel, "(title_block\n" );
|
||||
|
||||
if( !m_title.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "(title %s)\n", EscapedUTF8( m_title ).c_str() );
|
||||
aFormatter->Print( aNestLevel+1, "(title %s)\n",
|
||||
aFormatter->Quotew( m_title ).c_str() );
|
||||
|
||||
if( !m_date.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "(date %s)\n", EscapedUTF8( m_date ).c_str() );
|
||||
aFormatter->Print( aNestLevel+1, "(date %s)\n",
|
||||
aFormatter->Quotew( m_date ).c_str() );
|
||||
|
||||
if( !m_revision.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "(rev %s)\n", EscapedUTF8( m_revision ).c_str() );
|
||||
aFormatter->Print( aNestLevel+1, "(rev %s)\n",
|
||||
aFormatter->Quotew( m_revision ).c_str() );
|
||||
|
||||
if( !m_company.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "(company %s)\n", EscapedUTF8( m_company ).c_str() );
|
||||
aFormatter->Print( aNestLevel+1, "(company %s)\n",
|
||||
aFormatter->Quotew( m_company ).c_str() );
|
||||
|
||||
if( !m_comment1.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "(comment1 %s)\n", EscapedUTF8( m_comment1 ).c_str() );
|
||||
aFormatter->Print( aNestLevel+1, "(comment 1 %s)\n",
|
||||
aFormatter->Quotew( m_comment1 ).c_str() );
|
||||
|
||||
if( !m_comment2.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "(comment2 %s)\n", EscapedUTF8( m_comment2 ).c_str() );
|
||||
aFormatter->Print( aNestLevel+1, "(comment 2 %s)\n",
|
||||
aFormatter->Quotew( m_comment2 ).c_str() );
|
||||
|
||||
if( !m_comment3.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "(comment3 %s)\n", EscapedUTF8( m_comment3 ).c_str() );
|
||||
aFormatter->Print( aNestLevel+1, "(comment 3 %s)\n",
|
||||
aFormatter->Quotew( m_comment3 ).c_str() );
|
||||
|
||||
if( !m_comment4.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "(comment4 %s)\n", EscapedUTF8( m_comment4 ).c_str() );
|
||||
aFormatter->Print( aNestLevel+1, "(comment 4 %s)\n",
|
||||
aFormatter->Quotew( m_comment4 ).c_str() );
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n\n" );
|
||||
}
|
||||
|
|
|
@ -255,14 +255,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
|
|||
screen->SetCurItem( NULL );
|
||||
m_canvas->EndMouseCapture( -1, -1, wxEmptyString, false );
|
||||
|
||||
DLIST< SCH_ITEM > tmp;
|
||||
|
||||
for( item = s_wires.begin(); item != NULL; item = item->Next() )
|
||||
tmp.PushBack( (SCH_ITEM*) item->Clone() );
|
||||
|
||||
// Temporarily add the new segments to the schematic item list to test if any
|
||||
// junctions are required.
|
||||
screen->Append( tmp );
|
||||
screen->Append( s_wires );
|
||||
|
||||
// Correct and remove segments that need merged.
|
||||
screen->SchematicCleanUp( NULL, DC );
|
||||
|
@ -271,27 +264,15 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
|
|||
// removed by a cleanup, a junction may be needed to connect the segment's end point
|
||||
// which is also the same as the previous segment's start point.
|
||||
if( screen->IsJunctionNeeded( segment->GetEndPoint() ) )
|
||||
s_wires.Append( AddJunction( DC, segment->GetEndPoint() ) );
|
||||
screen->Append( AddJunction( DC, segment->GetEndPoint() ) );
|
||||
else if( screen->IsJunctionNeeded( segment->GetStartPoint() ) )
|
||||
s_wires.Append( AddJunction( DC, segment->GetStartPoint() ) );
|
||||
screen->Append( AddJunction( DC, segment->GetStartPoint() ) );
|
||||
|
||||
// Automatically place a junction on the start point if necessary because the cleanup
|
||||
// can suppress intermediate points by merging wire segments.
|
||||
if( screen->IsJunctionNeeded( s_startPoint ) )
|
||||
s_wires.Append( AddJunction( DC, s_startPoint ) );
|
||||
screen->Append( AddJunction( DC, s_startPoint ) );
|
||||
|
||||
// Make a copy of the original wires, buses, and junctions.
|
||||
for( item = s_oldWires.begin(); item != NULL; item = item->Next() )
|
||||
tmp.PushBack( (SCH_ITEM*) item->Clone() );
|
||||
|
||||
// Restore the old wires.
|
||||
if( tmp.GetCount() != 0 )
|
||||
screen->ReplaceWires( tmp );
|
||||
|
||||
// Now add the new wires and any required junctions to the schematic item list.
|
||||
screen->Append( s_wires );
|
||||
|
||||
screen->SchematicCleanUp( NULL, DC );
|
||||
m_canvas->Refresh();
|
||||
|
||||
// Put the snap shot of the previous wire, buses, and junctions in the undo/redo list.
|
||||
|
|
|
@ -300,7 +300,7 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff
|
|||
if( drawItem.m_Flags & IS_MOVED )
|
||||
continue;
|
||||
|
||||
/* Do not draw items not attached to the current part */
|
||||
// Do not draw items not attached to the current part
|
||||
if( aMulti && drawItem.m_Unit && ( drawItem.m_Unit != aMulti ) )
|
||||
continue;
|
||||
|
||||
|
@ -330,7 +330,7 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff
|
|||
if( drawItem.m_Flags & IS_MOVED )
|
||||
continue;
|
||||
|
||||
/* Do not draw items not attached to the current part */
|
||||
// Do not draw items not attached to the current part
|
||||
if( aMulti && drawItem.m_Unit && ( drawItem.m_Unit != aMulti ) )
|
||||
continue;
|
||||
|
||||
|
@ -358,7 +358,7 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff
|
|||
|
||||
}
|
||||
|
||||
/* Enable this to draw the anchor of the component. */
|
||||
// Enable this to draw the anchor of the component.
|
||||
#if 0
|
||||
int len = aDc->DeviceToLogicalXRel( 3 );
|
||||
|
||||
|
@ -534,10 +534,10 @@ bool LIB_COMPONENT::Save( OUTPUTFORMATTER& aFormatter )
|
|||
size_t i;
|
||||
LIB_FIELD& value = GetValueField();
|
||||
|
||||
/* First line: it s a comment (component name for readers) */
|
||||
// First line: it s a comment (component name for readers)
|
||||
aFormatter.Print( 0, "#\n# %s\n#\n", TO_UTF8( value.m_Text ) );
|
||||
|
||||
/* Save data */
|
||||
// Save data
|
||||
aFormatter.Print( 0, "DEF" );
|
||||
|
||||
if( value.IsVisible() )
|
||||
|
@ -618,7 +618,7 @@ bool LIB_COMPONENT::Save( OUTPUTFORMATTER& aFormatter )
|
|||
aFormatter.Print( 0, "\n" );
|
||||
}
|
||||
|
||||
/* Write the footprint filter list */
|
||||
// Write the footprint filter list
|
||||
if( m_FootprintList.GetCount() != 0 )
|
||||
{
|
||||
aFormatter.Print( 0, "$FPLIST\n" );
|
||||
|
@ -631,7 +631,7 @@ bool LIB_COMPONENT::Save( OUTPUTFORMATTER& aFormatter )
|
|||
aFormatter.Print( 0, "$ENDFPLIST\n" );
|
||||
}
|
||||
|
||||
/* Save graphics items (including pins) */
|
||||
// Save graphics items (including pins)
|
||||
if( !drawings.empty() )
|
||||
{
|
||||
/* we sort the draw items, in order to have an edition more easy,
|
||||
|
@ -680,21 +680,21 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Read DEF line: */
|
||||
// Read DEF line:
|
||||
char drawnum = 0;
|
||||
char drawname = 0;
|
||||
|
||||
if( ( componentName = strtok( NULL, " \t\n" ) ) == NULL /* Part name: */
|
||||
|| ( prefix = strtok( NULL, " \t\n" ) ) == NULL /* Prefix name: */
|
||||
|| ( p = strtok( NULL, " \t\n" ) ) == NULL /* NumOfPins: */
|
||||
if( ( componentName = strtok( NULL, " \t\n" ) ) == NULL // Part name:
|
||||
|| ( prefix = strtok( NULL, " \t\n" ) ) == NULL // Prefix name:
|
||||
|| ( p = strtok( NULL, " \t\n" ) ) == NULL // NumOfPins:
|
||||
|| sscanf( p, "%d", &unused ) != 1
|
||||
|| ( p = strtok( NULL, " \t\n" ) ) == NULL /* TextInside: */
|
||||
|| ( p = strtok( NULL, " \t\n" ) ) == NULL // TextInside:
|
||||
|| sscanf( p, "%d", &m_pinNameOffset ) != 1
|
||||
|| ( p = strtok( NULL, " \t\n" ) ) == NULL /* DrawNums: */
|
||||
|| ( p = strtok( NULL, " \t\n" ) ) == NULL // DrawNums:
|
||||
|| sscanf( p, "%c", &drawnum ) != 1
|
||||
|| ( p = strtok( NULL, " \t\n" ) ) == NULL /* DrawNums: */
|
||||
|| ( p = strtok( NULL, " \t\n" ) ) == NULL // DrawNums:
|
||||
|| sscanf( p, "%c", &drawname ) != 1
|
||||
|| ( p = strtok( NULL, " \t\n" ) ) == NULL /* m_unitCount: */
|
||||
|| ( p = strtok( NULL, " \t\n" ) ) == NULL // m_unitCount:
|
||||
|| sscanf( p, "%d", &m_unitCount ) != 1 )
|
||||
{
|
||||
aErrorMsg.Printf( wxT( "Wrong DEF format in line %d, skipped." ),
|
||||
|
@ -720,7 +720,7 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
|
|||
m_showPinNumbers = ( drawnum == 'N' ) ? false : true;
|
||||
m_showPinNames = ( drawname == 'N' ) ? false : true;
|
||||
|
||||
/* Copy part name and prefix. */
|
||||
// Copy part name and prefix.
|
||||
LIB_FIELD& value = GetValueField();
|
||||
|
||||
if( componentName[0] != '~' )
|
||||
|
@ -763,7 +763,7 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
|
|||
|
||||
p = strtok( line, " \t\r\n" );
|
||||
|
||||
/* This is the error flag ( if an error occurs, Res = false) */
|
||||
// This is the error flag ( if an error occurs, Res = false)
|
||||
Res = true;
|
||||
|
||||
if( *line == '#' ) // a comment
|
||||
|
@ -785,7 +785,7 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
|
|||
else if( strncmp( p, "$FPLIST", 5 ) == 0 )
|
||||
Res = LoadFootprints( aLineReader, Msg );
|
||||
|
||||
/* End line or block analysis: test for an error */
|
||||
// End line or block analysis: test for an error
|
||||
if( !Res )
|
||||
{
|
||||
if( Msg.IsEmpty() )
|
||||
|
@ -798,7 +798,7 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
|
|||
}
|
||||
}
|
||||
|
||||
/* If we are here, this part is O.k. - put it in: */
|
||||
// If we are here, this part is O.k. - put it in:
|
||||
drawings.sort();
|
||||
|
||||
return true;
|
||||
|
@ -827,34 +827,37 @@ bool LIB_COMPONENT::LoadDrawEntries( LINE_READER& aLineReader, wxString& aErrorM
|
|||
|
||||
switch( line[0] )
|
||||
{
|
||||
case 'A': /* Arc */
|
||||
case 'A': // Arc
|
||||
newEntry = ( LIB_ITEM* ) new LIB_ARC( this );
|
||||
break;
|
||||
|
||||
case 'C': /* Circle */
|
||||
case 'C': // Circle
|
||||
newEntry = ( LIB_ITEM* ) new LIB_CIRCLE( this );
|
||||
break;
|
||||
|
||||
case 'T': /* Text */
|
||||
case 'T': // Text
|
||||
newEntry = ( LIB_ITEM* ) new LIB_TEXT( this );
|
||||
break;
|
||||
|
||||
case 'S': /* Square */
|
||||
case 'S': // Square
|
||||
newEntry = ( LIB_ITEM* ) new LIB_RECTANGLE( this );
|
||||
break;
|
||||
|
||||
case 'X': /* Pin Description */
|
||||
case 'X': // Pin Description
|
||||
newEntry = ( LIB_ITEM* ) new LIB_PIN( this );
|
||||
break;
|
||||
|
||||
case 'P': /* Polyline */
|
||||
case 'P': // Polyline
|
||||
newEntry = ( LIB_ITEM* ) new LIB_POLYLINE( this );
|
||||
break;
|
||||
|
||||
case 'B': /* Bezier Curves */
|
||||
case 'B': // Bezier Curves
|
||||
newEntry = ( LIB_ITEM* ) new LIB_BEZIER( this );
|
||||
break;
|
||||
|
||||
case '#': // Comment
|
||||
continue;
|
||||
|
||||
default:
|
||||
aErrorMsg.Printf( wxT( "undefined DRAW command %c" ), line[0] );
|
||||
return false;
|
||||
|
@ -866,7 +869,7 @@ bool LIB_COMPONENT::LoadDrawEntries( LINE_READER& aLineReader, wxString& aErrorM
|
|||
GetChars( aErrorMsg ), line[0] );
|
||||
SAFE_DELETE( newEntry );
|
||||
|
||||
/* Flush till end of draw section */
|
||||
// Flush till end of draw section
|
||||
do
|
||||
{
|
||||
if( !aLineReader.ReadLine() )
|
||||
|
@ -1469,7 +1472,7 @@ void LIB_COMPONENT::SetConversion( bool aSetConvert )
|
|||
{
|
||||
BOOST_FOREACH( LIB_ITEM& item, drawings )
|
||||
{
|
||||
/* Only pins are duplicated. */
|
||||
// Only pins are duplicated.
|
||||
if( item.Type() != LIB_PIN_T )
|
||||
continue;
|
||||
|
||||
|
@ -1548,7 +1551,7 @@ void LIB_COMPONENT::SetAliases( const wxArrayString& aAliasList )
|
|||
m_aliases.push_back( new LIB_ALIAS( aAliasList[ i ], this ) );
|
||||
}
|
||||
|
||||
/* Remove names in the current component that are not in the new alias list. */
|
||||
// Remove names in the current component that are not in the new alias list.
|
||||
LIB_ALIASES::iterator it;
|
||||
|
||||
for( it = m_aliases.begin(); it < m_aliases.end(); it++ )
|
||||
|
|
|
@ -241,7 +241,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
|
|||
if( m_plot_Sheet_Ref )
|
||||
{
|
||||
plotter->SetColor( BLACK );
|
||||
m_Parent->PlotWorkSheet( plotter, screen );
|
||||
m_Parent->PlotWorkSheet( plotter, screen, g_DrawDefaultLineThickness );
|
||||
}
|
||||
|
||||
screen->Plot( plotter );
|
||||
|
|
|
@ -395,7 +395,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
|
|||
plotter->SetColor( BLACK );
|
||||
|
||||
if( s_plot_Sheet_Ref )
|
||||
m_Parent->PlotWorkSheet( plotter, screen );
|
||||
m_Parent->PlotWorkSheet( plotter, screen, g_DrawDefaultLineThickness );
|
||||
|
||||
screen->Plot( plotter );
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ void DIALOG_PLOT_SCHEMATIC_PDF::createPDFFile()
|
|||
|
||||
if( first_page ) {
|
||||
wxString msg;
|
||||
wxString plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet()
|
||||
wxString plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet()
|
||||
+ wxT( ".pdf" );
|
||||
msg.Printf( _( "Plot: %s " ), GetChars( plotFileName ) );
|
||||
m_MsgBox->AppendText( msg );
|
||||
|
@ -241,8 +241,8 @@ void DIALOG_PLOT_SCHEMATIC_PDF::createPDFFile()
|
|||
plotSetupPage( plotter, screen );
|
||||
plotter->StartPlot( output_file );
|
||||
first_page = false;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
/* For the following pages you need to close the (finished) page,
|
||||
reconfigure, and then start a new one */
|
||||
|
@ -301,7 +301,7 @@ void DIALOG_PLOT_SCHEMATIC_PDF::plotOneSheet( PDF_PLOTTER* plotter,
|
|||
if( m_plot_Sheet_Ref )
|
||||
{
|
||||
plotter->SetColor( BLACK );
|
||||
m_Parent->PlotWorkSheet( plotter, screen );
|
||||
m_Parent->PlotWorkSheet( plotter, screen, g_DrawDefaultLineThickness );
|
||||
}
|
||||
|
||||
screen->Plot( plotter );
|
||||
|
|
|
@ -294,7 +294,7 @@ void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
|
|||
if( m_plot_Sheet_Ref )
|
||||
{
|
||||
plotter->SetColor( BLACK );
|
||||
m_Parent->PlotWorkSheet( plotter, screen );
|
||||
m_Parent->PlotWorkSheet( plotter, screen, g_DrawDefaultLineThickness );
|
||||
}
|
||||
|
||||
screen->Plot( plotter );
|
||||
|
|
|
@ -33,8 +33,6 @@ class TRANSFORM;
|
|||
|
||||
#define HIGHLIGHT_COLOR WHITE
|
||||
|
||||
#define TEXT_NO_VISIBLE 1
|
||||
|
||||
//#define GR_DEFAULT_DRAWMODE GR_COPY
|
||||
#define GR_DEFAULT_DRAWMODE GR_COPY
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
wxFAIL_MSG( wxT( "SCH_EDIT_FRAME::OnLeftClick error. Item type <" ) +
|
||||
item->GetClass() + wxT( "> is already being edited." ) );
|
||||
item->ClearFlags();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -124,9 +125,12 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
case ID_NOCONN_BUTT:
|
||||
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
|
||||
{
|
||||
m_itemToRepeat = AddNoConnect( aDC, gridPosition );
|
||||
GetScreen()->SetCurItem( m_itemToRepeat );
|
||||
m_canvas->SetAutoPanRequest( true );
|
||||
if( false == GetScreen()->GetItem( gridPosition, 0, SCH_NO_CONNECT_T ) )
|
||||
{
|
||||
m_itemToRepeat = AddNoConnect( aDC, gridPosition );
|
||||
GetScreen()->SetCurItem( m_itemToRepeat );
|
||||
m_canvas->SetAutoPanRequest( true );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -138,9 +142,12 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
case ID_JUNCTION_BUTT:
|
||||
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
|
||||
{
|
||||
m_itemToRepeat = AddJunction( aDC, gridPosition, true );
|
||||
GetScreen()->SetCurItem( m_itemToRepeat );
|
||||
m_canvas->SetAutoPanRequest( true );
|
||||
if( false == GetScreen()->GetItem( gridPosition, 0, SCH_JUNCTION_T ) )
|
||||
{
|
||||
m_itemToRepeat = AddJunction( aDC, gridPosition, true );
|
||||
GetScreen()->SetCurItem( m_itemToRepeat );
|
||||
m_canvas->SetAutoPanRequest( true );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -434,14 +434,14 @@ bool SCH_SCREEN::SchematicCleanUp( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
|
|||
|
||||
for( ; item != NULL; item = item->Next() )
|
||||
{
|
||||
if( item->Type() != SCH_LINE_T )
|
||||
if( ( item->Type() != SCH_LINE_T ) && ( item->Type() != SCH_JUNCTION_T ) )
|
||||
continue;
|
||||
|
||||
testItem = item->Next();
|
||||
|
||||
while( testItem )
|
||||
{
|
||||
if( testItem->Type() == SCH_LINE_T )
|
||||
if( ( item->Type() == SCH_LINE_T ) && ( testItem->Type() == SCH_LINE_T ) )
|
||||
{
|
||||
SCH_LINE* line = (SCH_LINE*) item;
|
||||
|
||||
|
@ -458,6 +458,21 @@ bool SCH_SCREEN::SchematicCleanUp( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
|
|||
testItem = testItem->Next();
|
||||
}
|
||||
}
|
||||
else if ( ( ( item->Type() == SCH_JUNCTION_T ) && ( testItem->Type() == SCH_JUNCTION_T ) ) && ( testItem != item ) )
|
||||
{
|
||||
if ( testItem->HitTest( item->GetPosition() ) )
|
||||
{
|
||||
// Keep the current flags, because the deleted segment can be flagged.
|
||||
item->SetFlags( testItem->GetFlags() );
|
||||
DeleteItem( testItem );
|
||||
testItem = m_drawList.begin();
|
||||
modified = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
testItem = testItem->Next();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
testItem = testItem->Next();
|
||||
|
|
|
@ -185,42 +185,39 @@ const wxString GetPCBDefaultLayerName( int aLayerNumber )
|
|||
{
|
||||
const wxChar* txt;
|
||||
|
||||
// These are only default layer names. For Pcbnew the copper names
|
||||
// may be over-ridden in the BOARD (*.brd) file.
|
||||
|
||||
// Use a switch to explicitly show the mapping more clearly
|
||||
switch( aLayerNumber )
|
||||
{
|
||||
case LAYER_N_FRONT: txt = _( "Front" ); break;
|
||||
case LAYER_N_2: txt = _( "Inner2" ); break;
|
||||
case LAYER_N_3: txt = _( "Inner3" ); break;
|
||||
case LAYER_N_4: txt = _( "Inner4" ); break;
|
||||
case LAYER_N_5: txt = _( "Inner5" ); break;
|
||||
case LAYER_N_6: txt = _( "Inner6" ); break;
|
||||
case LAYER_N_7: txt = _( "Inner7" ); break;
|
||||
case LAYER_N_8: txt = _( "Inner8" ); break;
|
||||
case LAYER_N_9: txt = _( "Inner9" ); break;
|
||||
case LAYER_N_10: txt = _( "Inner10" ); break;
|
||||
case LAYER_N_11: txt = _( "Inner11" ); break;
|
||||
case LAYER_N_12: txt = _( "Inner12" ); break;
|
||||
case LAYER_N_13: txt = _( "Inner13" ); break;
|
||||
case LAYER_N_14: txt = _( "Inner14" ); break;
|
||||
case LAYER_N_15: txt = _( "Inner15" ); break;
|
||||
case LAYER_N_BACK: txt = _( "Back" ); break;
|
||||
case ADHESIVE_N_BACK: txt = _( "Adhes_Back" ); break;
|
||||
case ADHESIVE_N_FRONT: txt = _( "Adhes_Front" ); break;
|
||||
case SOLDERPASTE_N_BACK: txt = _( "SoldP_Back" ); break;
|
||||
case SOLDERPASTE_N_FRONT: txt = _( "SoldP_Front" ); break;
|
||||
case SILKSCREEN_N_BACK: txt = _( "SilkS_Back" ); break;
|
||||
case SILKSCREEN_N_FRONT: txt = _( "SilkS_Front" ); break;
|
||||
case SOLDERMASK_N_BACK: txt = _( "Mask_Back" ); break;
|
||||
case SOLDERMASK_N_FRONT: txt = _( "Mask_Front" ); break;
|
||||
case DRAW_N: txt = _( "Drawings" ); break;
|
||||
case COMMENT_N: txt = _( "Comments" ); break;
|
||||
case ECO1_N: txt = _( "Eco1" ); break;
|
||||
case ECO2_N: txt = _( "Eco2" ); break;
|
||||
case EDGE_N: txt = _( "PCB_Edges" ); break;
|
||||
default: txt = _( "BAD INDEX" ); break;
|
||||
case LAYER_N_FRONT: txt = _( "Front" ); break;
|
||||
case LAYER_N_2: txt = _( "Inner1" ); break;
|
||||
case LAYER_N_3: txt = _( "Inner2" ); break;
|
||||
case LAYER_N_4: txt = _( "Inner3" ); break;
|
||||
case LAYER_N_5: txt = _( "Inner4" ); break;
|
||||
case LAYER_N_6: txt = _( "Inner5" ); break;
|
||||
case LAYER_N_7: txt = _( "Inner6" ); break;
|
||||
case LAYER_N_8: txt = _( "Inner7" ); break;
|
||||
case LAYER_N_9: txt = _( "Inner8" ); break;
|
||||
case LAYER_N_10: txt = _( "Inner9" ); break;
|
||||
case LAYER_N_11: txt = _( "Inner10" ); break;
|
||||
case LAYER_N_12: txt = _( "Inner11" ); break;
|
||||
case LAYER_N_13: txt = _( "Inner12" ); break;
|
||||
case LAYER_N_14: txt = _( "Inner13" ); break;
|
||||
case LAYER_N_15: txt = _( "Inner14" ); break;
|
||||
case LAYER_N_BACK: txt = _( "Back" ); break;
|
||||
case ADHESIVE_N_BACK: txt = _( "Adhes_Back" ); break;
|
||||
case ADHESIVE_N_FRONT: txt = _( "Adhes_Front" ); break;
|
||||
case SOLDERPASTE_N_BACK: txt = _( "SoldP_Back" ); break;
|
||||
case SOLDERPASTE_N_FRONT: txt = _( "SoldP_Front" ); break;
|
||||
case SILKSCREEN_N_BACK: txt = _( "SilkS_Back" ); break;
|
||||
case SILKSCREEN_N_FRONT: txt = _( "SilkS_Front" ); break;
|
||||
case SOLDERMASK_N_BACK: txt = _( "Mask_Back" ); break;
|
||||
case SOLDERMASK_N_FRONT: txt = _( "Mask_Front" ); break;
|
||||
case DRAW_N: txt = _( "Drawings" ); break;
|
||||
case COMMENT_N: txt = _( "Comments" ); break;
|
||||
case ECO1_N: txt = _( "Eco1" ); break;
|
||||
case ECO2_N: txt = _( "Eco2" ); break;
|
||||
case EDGE_N: txt = _( "PCB_Edges" ); break;
|
||||
default: txt = wxT( "BAD INDEX" ); break;
|
||||
}
|
||||
|
||||
return wxString( txt );
|
||||
|
|
|
@ -109,7 +109,7 @@ EXTERN_BITMAP( cursor_shape_xpm )
|
|||
EXTERN_BITMAP( cursor_xpm )
|
||||
EXTERN_BITMAP( cut_button_xpm )
|
||||
EXTERN_BITMAP( cvpcb_xpm )
|
||||
EXTERN_BITMAP( dashedline_xpm )
|
||||
EXTERN_BITMAP( dashline_xpm )
|
||||
EXTERN_BITMAP( datasheet_xpm )
|
||||
EXTERN_BITMAP( delete_arc_xpm )
|
||||
EXTERN_BITMAP( delete_association_xpm )
|
||||
|
@ -253,7 +253,7 @@ EXTERN_BITMAP( leave_sheet_xpm )
|
|||
EXTERN_BITMAP( left_xpm )
|
||||
EXTERN_BITMAP( libedit_icon_xpm )
|
||||
EXTERN_BITMAP( libedit_xpm )
|
||||
EXTERN_BITMAP( libedit_part_xpm )
|
||||
EXTERN_BITMAP( libedprt_xpm )
|
||||
EXTERN_BITMAP( lib_next_xpm )
|
||||
EXTERN_BITMAP( lib_previous_xpm )
|
||||
EXTERN_BITMAP( library_browse_xpm )
|
||||
|
@ -271,7 +271,7 @@ EXTERN_BITMAP( mirror_h_xpm )
|
|||
EXTERN_BITMAP( mirror_v_xpm )
|
||||
EXTERN_BITMAP( mode_module_xpm )
|
||||
EXTERN_BITMAP( mode_track_xpm )
|
||||
EXTERN_BITMAP( mod_ratsnest_xpm )
|
||||
EXTERN_BITMAP( modratsnest_xpm )
|
||||
EXTERN_BITMAP( module_check_xpm )
|
||||
EXTERN_BITMAP( module_edit_xpm )
|
||||
EXTERN_BITMAP( module_wizard_xpm )
|
||||
|
@ -470,6 +470,7 @@ EXTERN_BITMAP( width_vias_xpm )
|
|||
EXTERN_BITMAP( window_close_xpm )
|
||||
EXTERN_BITMAP( zip_tool_xpm )
|
||||
EXTERN_BITMAP( zip_xpm )
|
||||
EXTERN_BITMAP( zone_duplicate_xpm )
|
||||
EXTERN_BITMAP( zone_unfill_xpm )
|
||||
EXTERN_BITMAP( zoom_area_xpm )
|
||||
EXTERN_BITMAP( zoom_center_on_screen_xpm )
|
||||
|
|
|
@ -37,7 +37,6 @@ public:
|
|||
int m_SolderPasteMargin; ///< Solder paste margin absolute value
|
||||
double m_SolderPasteMarginRatio; ///< Solder pask margin ratio value of pad size
|
||||
///< The final margin is the sum of these 2 values
|
||||
int m_BoardThickness; ///< Board Thickness for 3D viewer
|
||||
|
||||
// Variables used in footprint handling
|
||||
wxSize m_ModuleTextSize; ///< Default footprint texts size
|
||||
|
@ -188,11 +187,15 @@ public:
|
|||
*/
|
||||
void AppendConfigs( PARAM_CFG_ARRAY* aResult );
|
||||
|
||||
int GetBoardThickness() const { return m_boardThickness; }
|
||||
void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; }
|
||||
|
||||
private:
|
||||
int m_CopperLayerCount; ///< Number of copper layers for this design
|
||||
int m_EnabledLayers; ///< Bit-mask for layer enabling
|
||||
int m_VisibleLayers; ///< Bit-mask for layer visibility
|
||||
int m_VisibleElements; ///< Bit-mask for element category visibility
|
||||
int m_boardThickness; ///< Board thickness for 3D viewer
|
||||
};
|
||||
|
||||
#endif // BOARD_DESIGN_SETTINGS_H_
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 CERN
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file convert_from_iu.h
|
||||
* @brief Definitions and functions to convert from internal units to user units
|
||||
* depending upon the application and/or build options.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CONVERT_FROM_IU_
|
||||
#define _CONVERT_FROM_IU_
|
||||
|
||||
#include <config.h> // USE_PCBNEW_NANOMETRES is defined here
|
||||
|
||||
/// Convert from internal units to user units.
|
||||
#if defined(PCBNEW) || defined(CVPCB) || defined(GERBVIEW)
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
#if defined(GERBVIEW)
|
||||
#define MM_PER_IU 1.0 / 1e5 // Gerbview uses 10 micrometer.
|
||||
#else
|
||||
#define MM_PER_IU 1.0 / 1e6 // Pcbnew in nanometers.
|
||||
#endif
|
||||
#define MILS_PER_IU ( MM_PER_IU * 0.0254 )
|
||||
#define DECIMILS_PER_IU (MM_PER_IU * 0.00254 )
|
||||
#else // Pcbnew in deci-mils.
|
||||
#define DECIMILS_PER_IU 1
|
||||
#define MILS_PER_IU 10.0
|
||||
#define MM_PER_IU (1e4 / 25.4)
|
||||
#endif
|
||||
|
||||
/// Convert PCBNEW internal units (iu) to mils.
|
||||
inline int Iu2Mils( int iu )
|
||||
{
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
double x = iu * MILS_PER_IU;
|
||||
return int( x < 0 ? x - 0.5 : x + 0.5 );
|
||||
#else
|
||||
return iu * MILS_PER_IU;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Convert PCBNEW internal units (iu) to deci-mils.
|
||||
inline int Iu2DMils( int iu )
|
||||
{
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
double x = iu * DECIMILS_PER_IU;
|
||||
return int( x < 0 ? x - 0.5 : x + 0.5 );
|
||||
#else
|
||||
return iu;
|
||||
#endif
|
||||
}
|
||||
|
||||
#else // Eeschema and anything else.
|
||||
#define MILS_PER_IU 1.0
|
||||
#define MM_PER_IU (MILS_PER_IU / 0.0254)
|
||||
|
||||
inline int Iu2Mils( int iu )
|
||||
{
|
||||
return iu;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // #define _CONVERT_FROM_IU_
|
|
@ -57,7 +57,10 @@ enum EDA_DRAW_MODE_T {
|
|||
SKETCH // sketch mode: segments have thickness, but are not filled
|
||||
};
|
||||
|
||||
|
||||
#define DEFAULT_SIZE_TEXT 60 /* default text height (in mils or 1/1000") */
|
||||
#define TEXT_NO_VISIBLE 1 //< EDA_TEXT::m_Attribut(e?) visibility flag.
|
||||
|
||||
|
||||
/**
|
||||
* Class EDA_TEXT
|
||||
|
@ -110,6 +113,15 @@ public:
|
|||
void SetItalic( bool isItalic ) { m_Italic = isItalic; }
|
||||
bool IsItalic() const { return m_Italic; }
|
||||
|
||||
void SetBold( bool aBold ) { m_Bold = aBold; }
|
||||
bool IsBold() const { return m_Bold; }
|
||||
|
||||
void SetVisible( bool aVisible )
|
||||
{
|
||||
( aVisible ) ? m_Attributs &= ~TEXT_NO_VISIBLE : m_Attributs |= TEXT_NO_VISIBLE;
|
||||
}
|
||||
bool IsVisible() const { return !( m_Attributs & TEXT_NO_VISIBLE ); }
|
||||
|
||||
void SetMirrored( bool isMirrored ) { m_Mirror = isMirrored; }
|
||||
bool IsMirrored() const { return m_Mirror; }
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#define _LAYERS_ID_AND_VISIBILITY_H_
|
||||
|
||||
/* Layer identification (layer number) */
|
||||
#define UNDEFINED_LAYER -1
|
||||
#define FIRST_COPPER_LAYER 0
|
||||
#define LAYER_N_BACK 0
|
||||
#define LAYER_N_2 1
|
||||
|
|
|
@ -171,30 +171,12 @@ protected:
|
|||
virtual bool isAutoSaveRequired() const;
|
||||
|
||||
/**
|
||||
* Function propagate
|
||||
* Used now only in autoplace calculations
|
||||
* Uses the routing matrix to fill the cells within the zone
|
||||
* Search and mark cells within the zone, and agree with DRC options.
|
||||
* Requirements:
|
||||
* Start from an initial point, to fill zone
|
||||
* The zone must have no "copper island"
|
||||
* Algorithm:
|
||||
* If the current cell has a neighbor flagged as "cell in the zone", it
|
||||
* become a cell in the zone
|
||||
* The first point in the zone is the starting point
|
||||
* 4 searches within the matrix are made:
|
||||
* 1 - Left to right and top to bottom
|
||||
* 2 - Right to left and top to bottom
|
||||
* 3 - bottom to top and Right to left
|
||||
* 4 - bottom to top and Left to right
|
||||
* Given the current cell, for each search, we consider the 2 neighbor cells
|
||||
* the previous cell on the same line and the previous cell on the same column.
|
||||
*
|
||||
* This function can request some iterations
|
||||
* Iterations are made until no cell is added to the zone.
|
||||
* @return: added cells count (i.e. which the attribute CELL_is_ZONE is set)
|
||||
* Function duplicateZone
|
||||
* duplicates the given zone.
|
||||
* @param aDC is the current Device Context.
|
||||
* @param aZone is the zone to duplicate
|
||||
*/
|
||||
int propagate();
|
||||
void duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone );
|
||||
|
||||
public:
|
||||
PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
|
||||
|
@ -1452,7 +1434,7 @@ public:
|
|||
* The cost is the longest ratsnest distance with penalty for connections
|
||||
* approaching 45 degrees.
|
||||
*/
|
||||
float Compute_Ratsnest_PlaceModule( wxDC* DC );
|
||||
double Compute_Ratsnest_PlaceModule( wxDC* DC );
|
||||
|
||||
/**
|
||||
* Function GenPlaceBoard
|
||||
|
|
|
@ -686,7 +686,7 @@ public:
|
|||
int aNScr, int aScr, int aLnW, double aScalar,
|
||||
EDA_COLOR_T aClr1 = RED, EDA_COLOR_T aClr2 = RED );
|
||||
|
||||
void PlotWorkSheet( PLOTTER* aPlotter, BASE_SCREEN* aScreen );
|
||||
void PlotWorkSheet( PLOTTER* aPlotter, BASE_SCREEN* aScreen, int aLineWidth );
|
||||
|
||||
/**
|
||||
* Function GetXYSheetReferences
|
||||
|
|
|
@ -539,7 +539,10 @@ bool TREE_PROJECT_FRAME::AddFileToTree( const wxString& aName,
|
|||
bool addFile = false;
|
||||
for( unsigned i = 0; i < m_Filters.size(); i++ )
|
||||
{
|
||||
reg.Compile( m_Filters[i], wxRE_ICASE );
|
||||
wxCHECK2_MSG( reg.Compile( m_Filters[i], wxRE_ICASE ), continue,
|
||||
wxT( "Regular expression " ) + m_Filters[i] +
|
||||
wxT( " failed to compile." ) );
|
||||
|
||||
if( reg.Matches( aName ) )
|
||||
{
|
||||
addFile = true;
|
||||
|
|
|
@ -20,6 +20,7 @@ endif()
|
|||
include_directories(BEFORE ${INC_BEFORE})
|
||||
include_directories(
|
||||
./dialogs
|
||||
./autorouter
|
||||
../3d-viewer
|
||||
../common
|
||||
${Boost_INCLUDE_DIR}
|
||||
|
@ -107,30 +108,38 @@ set(PCBNEW_DIALOGS
|
|||
dialogs/dialog_footprint_wizard_list.cpp
|
||||
)
|
||||
|
||||
# some of the files here may be going to the dialog srcs in fact....
|
||||
set(PCBNEW_AUTOROUTER_SRCS
|
||||
autorouter/automove.cpp
|
||||
autorouter/autoplac.cpp
|
||||
autorouter/autorout.cpp
|
||||
autorouter/routing_matrix.cpp
|
||||
autorouter/dist.cpp
|
||||
autorouter/queue.cpp
|
||||
autorouter/solve.cpp
|
||||
autorouter/graphpcb.cpp
|
||||
autorouter/work.cpp
|
||||
)
|
||||
|
||||
set(PCBNEW_CLASS_SRCS
|
||||
tool_modview.cpp
|
||||
modview.cpp
|
||||
modview_frame.cpp
|
||||
pcbframe.cpp
|
||||
attribut.cpp
|
||||
automove.cpp
|
||||
autoplac.cpp
|
||||
autorout.cpp
|
||||
board.cpp
|
||||
board_items_to_polygon_shape_transform.cpp
|
||||
board_undo_redo.cpp
|
||||
block.cpp
|
||||
block_module_editor.cpp
|
||||
build_BOM_from_board.cpp
|
||||
class_pcb_layer_widget.cpp
|
||||
class_pcb_layer_box_selector.cpp
|
||||
clean.cpp
|
||||
connect.cpp
|
||||
controle.cpp
|
||||
dimension.cpp
|
||||
cross-probing.cpp
|
||||
deltrack.cpp
|
||||
dist.cpp
|
||||
${PCBNEW_DIALOGS}
|
||||
dragsegm.cpp
|
||||
drc.cpp
|
||||
drc_clearance_test_functions.cpp
|
||||
|
@ -154,7 +163,6 @@ set(PCBNEW_CLASS_SRCS
|
|||
gendrill.cpp
|
||||
globaleditpad.cpp
|
||||
gpcb_exchange.cpp
|
||||
graphpcb.cpp
|
||||
highlight.cpp
|
||||
hotkeys.cpp
|
||||
hotkeys_board_editor.cpp
|
||||
|
@ -194,10 +202,8 @@ set(PCBNEW_CLASS_SRCS
|
|||
plot_rtn.cpp
|
||||
print_board_functions.cpp
|
||||
printout_controler.cpp
|
||||
queue.cpp
|
||||
ratsnest.cpp
|
||||
set_grid.cpp
|
||||
solve.cpp
|
||||
specctra.cpp
|
||||
specctra_export.cpp
|
||||
specctra_import.cpp
|
||||
|
@ -210,7 +216,6 @@ set(PCBNEW_CLASS_SRCS
|
|||
tracepcb.cpp
|
||||
tr_modif.cpp
|
||||
trpiste.cpp
|
||||
work.cpp
|
||||
xchgmod.cpp
|
||||
zones_convert_brd_items_to_polygons_with_Boost.cpp
|
||||
zones_convert_to_polygons_aux_functions.cpp
|
||||
|
@ -225,7 +230,7 @@ set(PCBNEW_CLASS_SRCS
|
|||
class_footprint_wizard.cpp
|
||||
)
|
||||
|
||||
set(PCBNEW_SRCS ${PCBNEW_CLASS_SRCS} ${PCBNEW_DIALOGS})
|
||||
set(PCBNEW_SRCS ${PCBNEW_AUTOROUTER_SRCS} ${PCBNEW_CLASS_SRCS} ${PCBNEW_DIALOGS})
|
||||
|
||||
###
|
||||
# We need some extra sources from common
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
/**
|
||||
* @file ar_protos.h
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _AR_PROTOS_H_
|
||||
#define _AR_PROTOS_H_
|
||||
|
||||
|
||||
#include <autorout.h>
|
||||
|
||||
|
||||
class PCB_EDIT_FRAME;
|
||||
class BOARD;
|
||||
class D_PAD;
|
||||
class RATSNEST_ITEM;
|
||||
class TRACK;
|
||||
|
||||
|
||||
int Propagation( PCB_EDIT_FRAME* frame );
|
||||
|
||||
/* Initialize a color value, the cells included in the board edge of the
|
||||
* pad surface by pt_pad, with the margin reserved for isolation and the
|
||||
* half width of the runway
|
||||
* Parameters:
|
||||
* Pt_pad: pointer to the description of the pad
|
||||
* color: mask write in cells
|
||||
* margin: add a value to the radius or half the score pad
|
||||
* op_logic: type of writing in the cell (WRITE, OR)
|
||||
*/
|
||||
void PlacePad( BOARD* Pcb, D_PAD* pt_pad, int type, int marge, int op_logic );
|
||||
|
||||
/* Draws a segment of track on the board. */
|
||||
void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int type, int marge, int op_logic );
|
||||
|
||||
/* Uses the color value of all cells included in the board
|
||||
* coord of the rectangle ux0, uy0 (top right corner)
|
||||
* a ux1, uy1 (lower left corner) (coord PCB)
|
||||
* the rectangle is horizontal (or vertical)
|
||||
* masque_layer = mask layers;
|
||||
* op_logic = WRITE_CELL, WRITE_OR_CELL, WRITE_XOR_CELL, WRITE_AND_CELL
|
||||
*/
|
||||
void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
||||
int side, int color, int op_logic);
|
||||
|
||||
|
||||
/* Same as above, but the rectangle is inclined angle angle. */
|
||||
void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
||||
int angle, int masque_layer, int color, int op_logic );
|
||||
|
||||
/* QUEUE.CPP */
|
||||
void FreeQueue();
|
||||
void InitQueue();
|
||||
void GetQueue( int *, int *, int *, int *, int * );
|
||||
int SetQueue( int, int, int, int, int, int, int );
|
||||
void ReSetQueue( int, int, int, int, int, int, int );
|
||||
|
||||
/* WORK.CPP */
|
||||
void InitWork();
|
||||
void ReInitWork();
|
||||
int SetWork( int, int, int , int, int, RATSNEST_ITEM *, int );
|
||||
void GetWork( int *, int *, int *, int *, int *, RATSNEST_ITEM ** );
|
||||
void SortWork(); /* order the work items; shortest first */
|
||||
|
||||
/* DIST.CPP */
|
||||
int GetApxDist( int, int, int, int );
|
||||
int CalcDist( int, int, int ,int );
|
||||
|
||||
/* BOARD.CPP */
|
||||
int Build_Work( BOARD * Pcb );
|
||||
void PlaceCells( BOARD * Pcb, int net_code, int flag = 0 );
|
||||
|
||||
MATRIX_CELL GetCell( int aRow, int aCol, int aSide);
|
||||
void SetCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
|
||||
void OrCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
|
||||
void XorCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
|
||||
void AndCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
|
||||
void AddCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
|
||||
DIST_CELL GetDist( int aRow, int aCol, int aSide );
|
||||
void SetDist( int aRow, int aCol, int aSide, DIST_CELL );
|
||||
int GetDir( int aRow, int aCol, int aSide );
|
||||
void SetDir( int aRow, int aCol, int aSide, int aDir);
|
||||
|
||||
|
||||
#endif // _AR_PROTOS_H_
|
|
@ -1,7 +1,8 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
|
|
|
@ -1,140 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file autorout.h
|
||||
*/
|
||||
|
||||
#ifndef AUTOROUT_H
|
||||
#define AUTOROUT_H
|
||||
|
||||
|
||||
#include <base_struct.h>
|
||||
|
||||
|
||||
class BOARD;
|
||||
|
||||
|
||||
#define TOP 0
|
||||
#define BOTTOM 1
|
||||
#define EMPTY 0
|
||||
#define ILLEGAL -1
|
||||
|
||||
|
||||
/* Autorouter commands. */
|
||||
enum CommandOpt {
|
||||
PLACE_ALL,
|
||||
PLACE_OUT_OF_BOARD,
|
||||
PLACE_INCREMENTAL,
|
||||
PLACE_1_MODULE,
|
||||
|
||||
ROUTE_ALL,
|
||||
ROUTE_NET,
|
||||
ROUTE_MODULE,
|
||||
ROUTE_PAD
|
||||
};
|
||||
|
||||
|
||||
extern int E_scale; /* Scaling factor of distance tables. */
|
||||
|
||||
#define ONE_SIDE 0
|
||||
#define TWO_SIDES 1
|
||||
|
||||
#define MAX_SIDES_COUNT 2
|
||||
|
||||
extern int Nb_Sides; /* Number of layers for autorouting (0 or 1) */
|
||||
|
||||
#define FORCE_PADS 1 /* Force placement of pads for any Netcode */
|
||||
|
||||
/* board dimensions */
|
||||
extern int Nrows;
|
||||
extern int Ncols;
|
||||
extern int Ntotal;
|
||||
|
||||
/* search statistics */
|
||||
extern int OpenNodes; /* total number of nodes opened */
|
||||
extern int ClosNodes; /* total number of nodes closed */
|
||||
extern int MoveNodes; /* total number of nodes moved */
|
||||
extern int MaxNodes; /* maximum number of nodes opened at one time */
|
||||
|
||||
|
||||
/* Structures useful to the generation of board as bitmap. */
|
||||
typedef char MATRIX_CELL;
|
||||
typedef int DIST_CELL;
|
||||
typedef char DIR_CELL;
|
||||
|
||||
|
||||
/**
|
||||
* class MATRIX_ROUTING_HEAD
|
||||
*/
|
||||
class MATRIX_ROUTING_HEAD /* header of blocks of MATRIX_CELL */
|
||||
{
|
||||
public:
|
||||
MATRIX_CELL* m_BoardSide[MAX_SIDES_COUNT]; /* ptr to block of memory: 2-sided board */
|
||||
DIST_CELL* m_DistSide[MAX_SIDES_COUNT]; /* ptr to block of memory: path distance to
|
||||
* cells */
|
||||
DIR_CELL* m_DirSide[MAX_SIDES_COUNT]; /* header of blocks of chars:pointers back to
|
||||
* source */
|
||||
bool m_InitBoardDone;
|
||||
int m_Layers;
|
||||
int m_GridRouting; // Size of grid for autoplace/autoroute
|
||||
EDA_RECT m_BrdBox; // Actual board bounding box
|
||||
int m_Nrows, m_Ncols;
|
||||
int m_MemSize;
|
||||
|
||||
public:
|
||||
MATRIX_ROUTING_HEAD();
|
||||
~MATRIX_ROUTING_HEAD();
|
||||
|
||||
/**
|
||||
* Function ComputeMatrixSize
|
||||
* calculates the number of rows and columns of dimensions of \a aPcb for routing and
|
||||
* automatic calculation of area.
|
||||
*/
|
||||
bool ComputeMatrixSize( BOARD* aPcb );
|
||||
|
||||
/**
|
||||
* Function InitBoard
|
||||
* initializes the data structures.
|
||||
*
|
||||
* @return the amount of memory used or -1 if default.
|
||||
*/
|
||||
int InitBoard();
|
||||
|
||||
void UnInitBoard();
|
||||
};
|
||||
|
||||
extern MATRIX_ROUTING_HEAD Board; /* 2-sided board */
|
||||
|
||||
|
||||
/* Constants used to trace the cells on the BOARD */
|
||||
#define WRITE_CELL 0
|
||||
#define WRITE_OR_CELL 1
|
||||
#define WRITE_XOR_CELL 2
|
||||
#define WRITE_AND_CELL 3
|
||||
#define WRITE_ADD_CELL 4
|
||||
|
||||
|
||||
#endif // AUTOROUT_H
|
|
@ -1,9 +1,11 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* Copyright (C) 1992-2012 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
|
File diff suppressed because it is too large
Load Diff
|
@ -3,6 +3,33 @@
|
|||
* @brief Autorouting command and control.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
*
|
||||
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <wxPcbStruct.h>
|
||||
|
@ -11,25 +38,22 @@
|
|||
#include <pcbnew.h>
|
||||
#include <cell.h>
|
||||
#include <zones.h>
|
||||
#include <ar_protos.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <class_track.h>
|
||||
#include <convert_to_biu.h>
|
||||
|
||||
#include <autorout.h>
|
||||
|
||||
|
||||
int E_scale; /* Scaling factor of distance tables. */
|
||||
int Nb_Sides; /* Number of layer for autorouting (0 or 1) */
|
||||
int Nrows = ILLEGAL;
|
||||
int Ncols = ILLEGAL;
|
||||
int Ntotal;
|
||||
int OpenNodes; /* total number of nodes opened */
|
||||
int ClosNodes; /* total number of nodes closed */
|
||||
int MoveNodes; /* total number of nodes moved */
|
||||
int MaxNodes; /* maximum number of nodes opened at one time */
|
||||
|
||||
MATRIX_ROUTING_HEAD Board; /* 2-sided board */
|
||||
|
||||
MATRIX_ROUTING_HEAD RoutingMatrix; // routing matrix (grid) to route 2-sided boards
|
||||
|
||||
/* init board, route traces*/
|
||||
void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode )
|
||||
|
@ -139,18 +163,14 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode )
|
|||
start = time( NULL );
|
||||
|
||||
/* Calculation of no fixed routing to 5 mils and more. */
|
||||
Board.m_GridRouting = (int)GetScreen()->GetGridSize().x;
|
||||
RoutingMatrix.m_GridRouting = (int)GetScreen()->GetGridSize().x;
|
||||
|
||||
if( Board.m_GridRouting < 50 )
|
||||
Board.m_GridRouting = 50;
|
||||
if( RoutingMatrix.m_GridRouting < (5*IU_PER_MILS) )
|
||||
RoutingMatrix.m_GridRouting = 5*IU_PER_MILS;
|
||||
|
||||
E_scale = Board.m_GridRouting / 50;
|
||||
|
||||
if( E_scale < 1 )
|
||||
E_scale = 1;
|
||||
|
||||
/* Calculated ncol and nrow, matrix size for routing. */
|
||||
Board.ComputeMatrixSize( GetBoard() );
|
||||
RoutingMatrix.ComputeMatrixSize( GetBoard() );
|
||||
|
||||
m_messagePanel->EraseMsgBox();
|
||||
|
||||
|
@ -160,10 +180,10 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode )
|
|||
if( Route_Layer_TOP != Route_Layer_BOTTOM )
|
||||
Nb_Sides = TWO_SIDES;
|
||||
|
||||
if( Board.InitBoard() < 0 )
|
||||
if( RoutingMatrix.InitRoutingMatrix() < 0 )
|
||||
{
|
||||
wxMessageBox( _( "No memory for autorouting" ) );
|
||||
Board.UnInitBoard(); /* Free memory. */
|
||||
RoutingMatrix.UnInitRoutingMatrix(); /* Free memory. */
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -171,9 +191,9 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode )
|
|||
PlaceCells( GetBoard(), -1, FORCE_PADS );
|
||||
|
||||
/* Construction of the track list for router. */
|
||||
Build_Work( GetBoard() );
|
||||
RoutingMatrix.m_RouteCount = Build_Work( GetBoard() );
|
||||
|
||||
// DisplayBoard(m_canvas, DC);
|
||||
// DisplayRoutingMatrix( m_canvas, DC );
|
||||
|
||||
if( Nb_Sides == TWO_SIDES )
|
||||
Solve( DC, TWO_SIDES ); /* double face */
|
||||
|
@ -183,7 +203,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode )
|
|||
/* Free memory. */
|
||||
FreeQueue();
|
||||
InitWork(); /* Free memory for the list of router connections. */
|
||||
Board.UnInitBoard();
|
||||
RoutingMatrix.UnInitRoutingMatrix();
|
||||
stop = time( NULL ) - start;
|
||||
msg.Printf( wxT( "time = %d second%s" ), stop, ( stop == 1 ) ? wxT( "" ) : wxT( "s" ) );
|
||||
SetStatusText( msg );
|
||||
|
@ -207,13 +227,11 @@ void PCB_EDIT_FRAME::Reset_Noroutable( wxDC* DC )
|
|||
|
||||
|
||||
/* DEBUG Function: displays the routing matrix */
|
||||
void DisplayBoard( EDA_DRAW_PANEL* panel, wxDC* DC )
|
||||
void DisplayRoutingMatrix( EDA_DRAW_PANEL* panel, wxDC* DC )
|
||||
{
|
||||
int row, col, i, j;
|
||||
int dcell0, dcell1 = 0, color;
|
||||
int maxi;
|
||||
|
||||
maxi = 600 / Ncols;
|
||||
int maxi = 600 / RoutingMatrix.m_Ncols;
|
||||
maxi = ( maxi * 3 ) / 4;
|
||||
|
||||
if( !maxi )
|
||||
|
@ -221,12 +239,12 @@ void DisplayBoard( EDA_DRAW_PANEL* panel, wxDC* DC )
|
|||
|
||||
GRSetDrawMode( DC, GR_COPY );
|
||||
|
||||
for( col = 0; col < Ncols; col++ )
|
||||
for( int col = 0; col < RoutingMatrix.m_Ncols; col++ )
|
||||
{
|
||||
for( row = 0; row < Nrows; row++ )
|
||||
for( int row = 0; row < RoutingMatrix.m_Nrows; row++ )
|
||||
{
|
||||
color = 0;
|
||||
dcell0 = GetCell( row, col, BOTTOM );
|
||||
dcell0 = RoutingMatrix.GetCell( row, col, BOTTOM );
|
||||
|
||||
if( dcell0 & HOLE )
|
||||
color = GREEN;
|
||||
|
@ -251,8 +269,8 @@ void DisplayBoard( EDA_DRAW_PANEL* panel, wxDC* DC )
|
|||
#define DRAW_OFFSET_Y 20
|
||||
// if( color )
|
||||
{
|
||||
for( i = 0; i < maxi; i++ )
|
||||
for( j = 0; j < maxi; j++ )
|
||||
for( int i = 0; i < maxi; i++ )
|
||||
for( int j = 0; j < maxi; j++ )
|
||||
GRPutPixel( panel->GetClipBox(), DC,
|
||||
( col * maxi ) + i + DRAW_OFFSET_X,
|
||||
( row * maxi ) + j + DRAW_OFFSET_Y, color );
|
|
@ -0,0 +1,232 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
*
|
||||
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file autorout.h
|
||||
*/
|
||||
|
||||
#ifndef AUTOROUT_H
|
||||
#define AUTOROUT_H
|
||||
|
||||
|
||||
#include <base_struct.h>
|
||||
|
||||
|
||||
class BOARD;
|
||||
|
||||
|
||||
#define TOP 0
|
||||
#define BOTTOM 1
|
||||
#define EMPTY 0
|
||||
#define ILLEGAL -1
|
||||
|
||||
|
||||
/* Autorouter commands. */
|
||||
enum CommandOpt {
|
||||
PLACE_ALL,
|
||||
PLACE_OUT_OF_BOARD,
|
||||
PLACE_INCREMENTAL,
|
||||
PLACE_1_MODULE,
|
||||
|
||||
ROUTE_ALL,
|
||||
ROUTE_NET,
|
||||
ROUTE_MODULE,
|
||||
ROUTE_PAD
|
||||
};
|
||||
|
||||
|
||||
#define ONE_SIDE 0
|
||||
#define TWO_SIDES 1
|
||||
|
||||
#define MAX_SIDES_COUNT 2
|
||||
|
||||
extern int Nb_Sides; /* Number of layers for autorouting (0 or 1) */
|
||||
|
||||
#define FORCE_PADS 1 /* Force placement of pads for any Netcode */
|
||||
|
||||
/* search statistics */
|
||||
extern int OpenNodes; /* total number of nodes opened */
|
||||
extern int ClosNodes; /* total number of nodes closed */
|
||||
extern int MoveNodes; /* total number of nodes moved */
|
||||
extern int MaxNodes; /* maximum number of nodes opened at one time */
|
||||
|
||||
|
||||
/* Structures useful to the generation of board as bitmap. */
|
||||
typedef char MATRIX_CELL;
|
||||
typedef int DIST_CELL;
|
||||
typedef char DIR_CELL;
|
||||
|
||||
|
||||
/**
|
||||
* class MATRIX_ROUTING_HEAD
|
||||
* handle the matrix routing that describes the actual board
|
||||
*/
|
||||
class MATRIX_ROUTING_HEAD
|
||||
{
|
||||
public:
|
||||
MATRIX_CELL* m_BoardSide[MAX_SIDES_COUNT]; // the image map of 2 board sides
|
||||
DIST_CELL* m_DistSide[MAX_SIDES_COUNT]; // the image map of 2 board sides: distance to
|
||||
// cells
|
||||
DIR_CELL* m_DirSide[MAX_SIDES_COUNT]; // the image map of 2 board sides: pointers back to
|
||||
// source
|
||||
bool m_InitMatrixDone;
|
||||
int m_Layers; // Layer count (1 2 )
|
||||
int m_GridRouting; // Size of grid for autoplace/autoroute
|
||||
EDA_RECT m_BrdBox; // Actual board bounding box
|
||||
int m_Nrows, m_Ncols; // Matrix size
|
||||
int m_MemSize; // Memory requirement, just for statistics
|
||||
int m_RouteCount; // Number of routes
|
||||
private:
|
||||
void (MATRIX_ROUTING_HEAD::* m_opWriteCell)( int aRow, int aCol, int aSide, MATRIX_CELL aCell); // a pointeur to the current selected cell op
|
||||
|
||||
public:
|
||||
MATRIX_ROUTING_HEAD();
|
||||
~MATRIX_ROUTING_HEAD();
|
||||
|
||||
void WriteCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell)
|
||||
{
|
||||
(*this.*m_opWriteCell)( aRow, aCol, aSide, aCell );
|
||||
}
|
||||
|
||||
/**
|
||||
* function GetBrdCoordOrigin
|
||||
* @returns the board coordinate corresponding to the
|
||||
* routing matrix origin ( board coordinate offset )
|
||||
*/
|
||||
wxPoint GetBrdCoordOrigin()
|
||||
{
|
||||
return m_BrdBox.GetOrigin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function ComputeMatrixSize
|
||||
* calculates the number of rows and columns of dimensions of \a aPcb for routing and
|
||||
* automatic calculation of area.
|
||||
* @param aPcb = the physical board
|
||||
* @param aUseBoardEdgesOnly = true to use board edges only,
|
||||
* = false to use the full board bounding box (default)
|
||||
*/
|
||||
bool ComputeMatrixSize( BOARD* aPcb, bool aUseBoardEdgesOnly = false );
|
||||
|
||||
/**
|
||||
* Function InitBoard
|
||||
* initializes the data structures.
|
||||
*
|
||||
* @return the amount of memory used or -1 if default.
|
||||
*/
|
||||
int InitRoutingMatrix();
|
||||
|
||||
void UnInitRoutingMatrix();
|
||||
|
||||
// Initialize WriteCell to make the aLogicOp
|
||||
void SetCellOperation( int aLogicOp );
|
||||
|
||||
// functions to read/write one cell ( point on grid routing matrix:
|
||||
MATRIX_CELL GetCell( int aRow, int aCol, int aSide);
|
||||
void SetCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
|
||||
void OrCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
|
||||
void XorCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
|
||||
void AndCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
|
||||
void AddCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
|
||||
DIST_CELL GetDist( int aRow, int aCol, int aSide );
|
||||
void SetDist( int aRow, int aCol, int aSide, DIST_CELL );
|
||||
int GetDir( int aRow, int aCol, int aSide );
|
||||
void SetDir( int aRow, int aCol, int aSide, int aDir);
|
||||
};
|
||||
|
||||
extern MATRIX_ROUTING_HEAD RoutingMatrix; /* 2-sided board */
|
||||
|
||||
|
||||
/* Constants used to trace the cells on the BOARD */
|
||||
#define WRITE_CELL 0
|
||||
#define WRITE_OR_CELL 1
|
||||
#define WRITE_XOR_CELL 2
|
||||
#define WRITE_AND_CELL 3
|
||||
#define WRITE_ADD_CELL 4
|
||||
|
||||
// Functions:
|
||||
|
||||
class PCB_EDIT_FRAME;
|
||||
class BOARD;
|
||||
class D_PAD;
|
||||
class RATSNEST_ITEM;
|
||||
class TRACK;
|
||||
|
||||
|
||||
/* Initialize a color value, the cells included in the board edge of the
|
||||
* pad surface by pt_pad, with the margin reserved for isolation and the
|
||||
* half width of the runway
|
||||
* Parameters:
|
||||
* Pt_pad: pointer to the description of the pad
|
||||
* color: mask write in cells
|
||||
* margin: add a value to the radius or half the score pad
|
||||
* op_logic: type of writing in the cell (WRITE, OR)
|
||||
*/
|
||||
void PlacePad( D_PAD* pt_pad, int type, int marge, int op_logic );
|
||||
|
||||
/* Draws a segment of track on the board. */
|
||||
void TraceSegmentPcb( TRACK* pt_segm, int type, int marge, int op_logic );
|
||||
|
||||
/* Uses the color value of all cells included in the board
|
||||
* coord of the rectangle ux0, uy0 (top right corner)
|
||||
* a ux1, uy1 (lower left corner) (coord PCB)
|
||||
* the rectangle is horizontal (or vertical)
|
||||
* masque_layer = mask layers;
|
||||
* op_logic = WRITE_CELL, WRITE_OR_CELL, WRITE_XOR_CELL, WRITE_AND_CELL
|
||||
*/
|
||||
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
|
||||
int side, int color, int op_logic);
|
||||
|
||||
|
||||
/* Same as above, but the rectangle is inclined angle angle. */
|
||||
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
|
||||
int angle, int masque_layer, int color, int op_logic );
|
||||
|
||||
/* QUEUE.CPP */
|
||||
void FreeQueue();
|
||||
void InitQueue();
|
||||
void GetQueue( int *, int *, int *, int *, int * );
|
||||
int SetQueue( int, int, int, int, int, int, int );
|
||||
void ReSetQueue( int, int, int, int, int, int, int );
|
||||
|
||||
/* WORK.CPP */
|
||||
void InitWork();
|
||||
void ReInitWork();
|
||||
int SetWork( int, int, int , int, int, RATSNEST_ITEM *, int );
|
||||
void GetWork( int *, int *, int *, int *, int *, RATSNEST_ITEM ** );
|
||||
void SortWork(); /* order the work items; shortest first */
|
||||
|
||||
/* DIST.CPP */
|
||||
int GetApxDist( int r1, int c1, int r2, int c2 );
|
||||
int CalcDist(int x,int y,int z ,int side );
|
||||
|
||||
/* routing_matrix.cpp */
|
||||
int Build_Work( BOARD * Pcb );
|
||||
void PlaceCells( BOARD * Pcb, int net_code, int flag = 0 );
|
||||
|
||||
|
||||
#endif // AUTOROUT_H
|
|
@ -2,6 +2,36 @@
|
|||
* @file cell.h
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
*
|
||||
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* First copyright (C) Randy Nevin, 1989 (see PCBCA package)
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CELL_H_
|
||||
#define _CELL_H_
|
||||
|
|
@ -3,20 +3,41 @@
|
|||
* @brief Routines to calculate PCB editor auto routing distances.
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <macros.h>
|
||||
#include <common.h>
|
||||
#include <pcbnew.h>
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* First copyright (C) Randy Nevin, 1989 (see PCBCA package)
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
#include <autorout.h>
|
||||
#include <cell.h>
|
||||
|
||||
|
||||
/* The tables of distances and keep out areas are established on the basis of not
|
||||
* routing of 50 units (the pitch between the cells is 50 units) The true distance
|
||||
* is computed by a scaling factor
|
||||
/* The tables of distances and keep out areas are established on the basis of a
|
||||
* 50 units grid size (the pitch between the cells is 50 units).
|
||||
* The actual distance could be computed by a scaling factor, but this is
|
||||
* not needed, we can use only reduced values
|
||||
*/
|
||||
|
||||
/* calculate approximate distance
|
||||
/* calculate approximate distance (manhattan distance)
|
||||
*/
|
||||
int GetApxDist( int r1, int c1, int r2, int c2 )
|
||||
{
|
||||
|
@ -28,27 +49,13 @@ int GetApxDist( int r1, int c1, int r2, int c2 )
|
|||
if( ( d2 = c1 - c2 ) < 0 ) /* get absolute column delta */
|
||||
d2 = -d2;
|
||||
|
||||
return ( d1+d2 ) * 50 * E_scale;
|
||||
|
||||
if( !d1 ) /* in same row? */
|
||||
return d2 * 50 * E_scale; /* 50 mils per cell */
|
||||
|
||||
if( !d2 ) /* in same column? */
|
||||
return d1 *50 * E_scale; /* 50 mils per cell */
|
||||
|
||||
if( d1 > d2 ) /* get smaller into d1 */
|
||||
{
|
||||
EXCHG(d1,d2);
|
||||
}
|
||||
|
||||
d2 -= d1; /* get non-diagonal part of approximate "route" */
|
||||
|
||||
return ( ( ( d1 * 71 ) + ( d2 * 50 ) ) * E_scale ); /* 71 mils diagonally per cell */
|
||||
return ( d1+d2 ) * 50;
|
||||
}
|
||||
|
||||
|
||||
/* distance to go thru a cell (en mils) */
|
||||
static int dist[10][10] = { /* OT=Otherside, OR=Origin (source) cell */
|
||||
static const int dist[10][10] =
|
||||
{ /* OT=Otherside, OR=Origin (source) cell */
|
||||
/*..........N, NE, E, SE, S, SW, W, NW, OT, OR */
|
||||
/* N */ { 50, 60, 35, 60, 99, 60, 35, 60, 12, 12 },
|
||||
/* NE */ { 60, 71, 60, 71, 60, 99, 60, 71, 23, 23 },
|
||||
|
@ -61,10 +68,11 @@ static int dist[10][10] = { /* OT=Otherside, OR=Origin (source) cell */
|
|||
|
||||
/* OT */ { 12, 23, 12, 23, 12, 23, 12, 23, 99, 99 },
|
||||
/* OR */ { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }
|
||||
};
|
||||
};
|
||||
|
||||
/* penalty for extraneous holes and corners, scaled by sharpness of turn */
|
||||
static int penalty[10][10] = { /* OT=Otherside, OR=Origin (source) cell */
|
||||
static const int penalty[10][10] =
|
||||
{ /* OT=Otherside, OR=Origin (source) cell */
|
||||
/*......... N, NE, E, SE, S, SW, W, NW, OT, OR */
|
||||
/* N */ { 0, 5, 10, 15, 20, 15, 10, 5, 50, 0 },
|
||||
/* NE */ { 5, 0, 5, 10, 15, 20, 15, 10, 50, 0 },
|
||||
|
@ -77,11 +85,12 @@ static int penalty[10][10] = { /* OT=Otherside, OR=Origin (source) cell */
|
|||
|
||||
/* OT */ { 50, 50, 50, 50, 50, 50, 50, 50, 100, 0 },
|
||||
/* OR */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
};
|
||||
|
||||
/* penalty pour directions preferencielles */
|
||||
#define PN 20
|
||||
static int dir_penalty_TOP[10][10] = {
|
||||
static const int dir_penalty_TOP[10][10] =
|
||||
{
|
||||
/* OT=Otherside, OR=Origin (source) cell */
|
||||
/*......... N, NE, E, SE, S, SW, W, NW, OT, OR */
|
||||
/* N */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 },
|
||||
|
@ -95,9 +104,10 @@ static int dir_penalty_TOP[10][10] = {
|
|||
|
||||
/* OT */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 },
|
||||
/* OR */ { PN, 0, 0, 0, PN, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
};
|
||||
|
||||
static int dir_penalty_BOTTOM[10][10] = {
|
||||
static int dir_penalty_BOTTOM[10][10] =
|
||||
{
|
||||
/* OT=Otherside, OR=Origin (source) cell */
|
||||
/*......... N, NE, E, SE, S, SW, W, NW, OT, OR */
|
||||
/* N */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 },
|
||||
|
@ -111,7 +121,7 @@ static int dir_penalty_BOTTOM[10][10] = {
|
|||
|
||||
/* OT */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 },
|
||||
/* OR */ { 0, 0, PN, 0, 0, 0, PN, 0, 0, 0 }
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
** x is the direction to enter the cell of interest.
|
||||
|
@ -122,11 +132,9 @@ static int dir_penalty_BOTTOM[10][10] = {
|
|||
** the calculation is driven by the tables above.
|
||||
*/
|
||||
|
||||
/************************************/
|
||||
/* int CalcDist(int x,int y,int z ) */
|
||||
/************************************/
|
||||
|
||||
/* calculate distance of a trace through a cell */
|
||||
/* calculate distance (with penalty) of a trace through a cell
|
||||
*/
|
||||
int CalcDist(int x,int y,int z ,int side )
|
||||
{
|
||||
int adjust, ldist;
|
|
@ -3,6 +3,33 @@
|
|||
* @brief PCB editor autorouting and "graphics" routines.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
*
|
||||
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
#include <macros.h>
|
||||
|
@ -13,38 +40,24 @@
|
|||
#include <class_track.h>
|
||||
|
||||
#include <pcbnew.h>
|
||||
#include <autorout.h>
|
||||
#include <cell.h>
|
||||
#include <ar_protos.h>
|
||||
|
||||
|
||||
int ToMatrixCoordinate( int aPhysicalCoordinate );
|
||||
|
||||
void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color );
|
||||
|
||||
void TraceArc( int ux0,
|
||||
int uy0,
|
||||
int ux1,
|
||||
int uy1,
|
||||
void TraceArc( int ux0, int uy0,
|
||||
int ux1, int uy1,
|
||||
int ArcAngle,
|
||||
int lg,
|
||||
int layer,
|
||||
int color,
|
||||
int lg, int layer, int color,
|
||||
int op_logic );
|
||||
|
||||
|
||||
static void DrawSegmentQcq( int ux0,
|
||||
int uy0,
|
||||
int ux1,
|
||||
int uy1,
|
||||
int lg,
|
||||
int layer,
|
||||
int color,
|
||||
static void DrawSegmentQcq( int ux0, int uy0,
|
||||
int ux1, int uy1,
|
||||
int lg, int layer, int color,
|
||||
int op_logic );
|
||||
|
||||
static void TraceFilledCircle( BOARD* aPcb,
|
||||
int cx,
|
||||
int cy,
|
||||
int radius,
|
||||
static void TraceFilledCircle( int cx, int cy, int radius,
|
||||
int aLayerMask,
|
||||
int color,
|
||||
int op_logic );
|
||||
|
@ -57,34 +70,21 @@ static void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
|
|||
{ \
|
||||
if( layer < 0 ) \
|
||||
{ \
|
||||
WriteCell( dy, dx, BOTTOM, color ); \
|
||||
RoutingMatrix.WriteCell( dy, dx, BOTTOM, color ); \
|
||||
if( Nb_Sides ) \
|
||||
WriteCell( dy, dx, TOP, color ); \
|
||||
RoutingMatrix.WriteCell( dy, dx, TOP, color ); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if( layer == Route_Layer_BOTTOM ) \
|
||||
WriteCell( dy, dx, BOTTOM, color ); \
|
||||
RoutingMatrix.WriteCell( dy, dx, BOTTOM, color ); \
|
||||
if( Nb_Sides ) \
|
||||
if( layer == Route_Layer_TOP ) \
|
||||
WriteCell( dy, dx, TOP, color ); \
|
||||
RoutingMatrix.WriteCell( dy, dx, TOP, color ); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function ToMatrixCoordinate
|
||||
* compute the coordinate in the routing matrix from the real (board) value
|
||||
* @param aPhysicalCoordinate = value to convert
|
||||
* @return the coordinate relative to the matrix
|
||||
*/
|
||||
int ToMatrixCoordinate( int aPhysicalCoordinate )
|
||||
{
|
||||
return aPhysicalCoordinate / Board.m_GridRouting;
|
||||
}
|
||||
|
||||
|
||||
void PlacePad( BOARD* aPcb, D_PAD* aPad, int color, int marge, int op_logic )
|
||||
void PlacePad( D_PAD* aPad, int color, int marge, int op_logic )
|
||||
{
|
||||
int dx, dy;
|
||||
wxPoint shape_pos = aPad->ReturnShapePos();
|
||||
|
@ -94,7 +94,7 @@ void PlacePad( BOARD* aPcb, D_PAD* aPad, int color, int marge, int op_logic )
|
|||
|
||||
if( aPad->GetShape() == PAD_CIRCLE )
|
||||
{
|
||||
TraceFilledCircle( aPcb, shape_pos.x, shape_pos.y, dx,
|
||||
TraceFilledCircle( shape_pos.x, shape_pos.y, dx,
|
||||
aPad->GetLayerMask(), color, op_logic );
|
||||
return;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ void PlacePad( BOARD* aPcb, D_PAD* aPad, int color, int marge, int op_logic )
|
|||
dy += abs( aPad->GetDelta().x ) / 2;
|
||||
}
|
||||
|
||||
// The pad is a rectangle horizontally or vertically.
|
||||
// The pad is a rectangle ( horizontal or vertical )
|
||||
if( int( aPad->GetOrientation() ) % 900 == 0 )
|
||||
{
|
||||
// Orientation turned 90 deg.
|
||||
|
@ -117,13 +117,13 @@ void PlacePad( BOARD* aPcb, D_PAD* aPad, int color, int marge, int op_logic )
|
|||
EXCHG( dx, dy );
|
||||
}
|
||||
|
||||
TraceFilledRectangle( aPcb, shape_pos.x - dx, shape_pos.y - dy,
|
||||
TraceFilledRectangle( shape_pos.x - dx, shape_pos.y - dy,
|
||||
shape_pos.x + dx, shape_pos.y + dy,
|
||||
aPad->GetLayerMask(), color, op_logic );
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceFilledRectangle( aPcb, shape_pos.x - dx, shape_pos.y - dy,
|
||||
TraceFilledRectangle( shape_pos.x - dx, shape_pos.y - dy,
|
||||
shape_pos.x + dx, shape_pos.y + dy,
|
||||
(int) aPad->GetOrientation(),
|
||||
aPad->GetLayerMask(), color, op_logic );
|
||||
|
@ -131,18 +131,15 @@ void PlacePad( BOARD* aPcb, D_PAD* aPad, int color, int marge, int op_logic )
|
|||
}
|
||||
|
||||
|
||||
/* Initialize a color value, the cells included in the board area of the
|
||||
* circle center cx, cy.
|
||||
/* Set to color the cells included in the circle
|
||||
* Parameters:
|
||||
* center: cx, cy.
|
||||
* radius: a value add to the radius or half the score pad
|
||||
* aLayerMask: layer occupied
|
||||
* color: mask write in cells
|
||||
* op_logic: type of writing in the cell (WRITE, OR)
|
||||
*/
|
||||
void TraceFilledCircle( BOARD* aPcb,
|
||||
int cx,
|
||||
int cy,
|
||||
int radius,
|
||||
void TraceFilledCircle( int cx, int cy, int radius,
|
||||
int aLayerMask,
|
||||
int color,
|
||||
int op_logic )
|
||||
|
@ -151,17 +148,10 @@ void TraceFilledCircle( BOARD* aPcb,
|
|||
int ux0, uy0, ux1, uy1;
|
||||
int row_max, col_max, row_min, col_min;
|
||||
int trace = 0;
|
||||
float fdistmin, fdistx, fdisty;
|
||||
|
||||
void (* WriteCell)( int, int, int, MATRIX_CELL );
|
||||
double fdistmin, fdistx, fdisty;
|
||||
int tstwrite = 0;
|
||||
int distmin;
|
||||
|
||||
// Determine occupied layer.
|
||||
|
||||
/* Single routing layer on bitmap and BOTTOM
|
||||
* Route_Layer_B = Route_Layer_A */
|
||||
|
||||
if( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) )
|
||||
trace = 1; // Trace on BOTTOM
|
||||
|
||||
|
@ -172,32 +162,10 @@ void TraceFilledCircle( BOARD* aPcb,
|
|||
if( trace == 0 )
|
||||
return;
|
||||
|
||||
switch( op_logic )
|
||||
{
|
||||
default:
|
||||
case WRITE_CELL:
|
||||
WriteCell = SetCell;
|
||||
break;
|
||||
RoutingMatrix.SetCellOperation( op_logic );
|
||||
|
||||
case WRITE_OR_CELL:
|
||||
WriteCell = OrCell;
|
||||
break;
|
||||
|
||||
case WRITE_XOR_CELL:
|
||||
WriteCell = XorCell;
|
||||
break;
|
||||
|
||||
case WRITE_AND_CELL:
|
||||
WriteCell = AndCell;
|
||||
break;
|
||||
|
||||
case WRITE_ADD_CELL:
|
||||
WriteCell = AddCell;
|
||||
break;
|
||||
}
|
||||
|
||||
cx -= aPcb->GetBoundingBox().GetX();
|
||||
cy -= aPcb->GetBoundingBox().GetY();
|
||||
cx -= RoutingMatrix.GetBrdCoordOrigin().x;
|
||||
cy -= RoutingMatrix.GetBrdCoordOrigin().y;
|
||||
|
||||
distmin = radius;
|
||||
|
||||
|
@ -208,22 +176,22 @@ void TraceFilledCircle( BOARD* aPcb,
|
|||
uy1 = cy + radius;
|
||||
|
||||
// Calculate limit coordinates of cells belonging to the rectangle.
|
||||
row_max = uy1 / Board.m_GridRouting;
|
||||
col_max = ux1 / Board.m_GridRouting;
|
||||
row_min = uy0 / Board.m_GridRouting; // if (uy0 > row_min*Board.m_GridRouting) row_min++;
|
||||
col_min = ux0 / Board.m_GridRouting; // if (ux0 > col_min*Board.m_GridRouting) col_min++;
|
||||
row_max = uy1 / RoutingMatrix.m_GridRouting;
|
||||
col_max = ux1 / RoutingMatrix.m_GridRouting;
|
||||
row_min = uy0 / RoutingMatrix.m_GridRouting; // if (uy0 > row_min*Board.m_GridRouting) row_min++;
|
||||
col_min = ux0 / RoutingMatrix.m_GridRouting; // if (ux0 > col_min*Board.m_GridRouting) col_min++;
|
||||
|
||||
if( row_min < 0 )
|
||||
row_min = 0;
|
||||
|
||||
if( row_max >= (Nrows - 1) )
|
||||
row_max = Nrows - 1;
|
||||
if( row_max >= (RoutingMatrix.m_Nrows - 1) )
|
||||
row_max = RoutingMatrix.m_Nrows - 1;
|
||||
|
||||
if( col_min < 0 )
|
||||
col_min = 0;
|
||||
|
||||
if( col_max >= (Ncols - 1) )
|
||||
col_max = Ncols - 1;
|
||||
if( col_max >= (RoutingMatrix.m_Ncols - 1) )
|
||||
col_max = RoutingMatrix.m_Ncols - 1;
|
||||
|
||||
// Calculate coordinate limits of cell belonging to the rectangle.
|
||||
if( row_min > row_max )
|
||||
|
@ -232,26 +200,26 @@ void TraceFilledCircle( BOARD* aPcb,
|
|||
if( col_min > col_max )
|
||||
col_max = col_min;
|
||||
|
||||
fdistmin = (float) distmin * distmin;
|
||||
fdistmin = (double) distmin * distmin;
|
||||
|
||||
for( row = row_min; row <= row_max; row++ )
|
||||
{
|
||||
fdisty = (float) ( cy - ( row * Board.m_GridRouting ) );
|
||||
fdisty = (double) ( cy - ( row * RoutingMatrix.m_GridRouting ) );
|
||||
fdisty *= fdisty;
|
||||
|
||||
for( col = col_min; col <= col_max; col++ )
|
||||
{
|
||||
fdistx = (float) ( cx - ( col * Board.m_GridRouting ) );
|
||||
fdistx = (double) ( cx - ( col * RoutingMatrix.m_GridRouting ) );
|
||||
fdistx *= fdistx;
|
||||
|
||||
if( fdistmin <= ( fdistx + fdisty ) )
|
||||
continue;
|
||||
|
||||
if( trace & 1 )
|
||||
WriteCell( row, col, BOTTOM, color );
|
||||
RoutingMatrix.WriteCell( row, col, BOTTOM, color );
|
||||
|
||||
if( trace & 2 )
|
||||
WriteCell( row, col, TOP, color );
|
||||
RoutingMatrix.WriteCell( row, col, TOP, color );
|
||||
|
||||
tstwrite = 1;
|
||||
}
|
||||
|
@ -263,33 +231,33 @@ void TraceFilledCircle( BOARD* aPcb,
|
|||
/* If no cell has been written, it affects the 4 neighboring diagonal
|
||||
* (Adverse event: pad off grid in the center of the 4 neighboring
|
||||
* diagonal) */
|
||||
distmin = Board.m_GridRouting / 2 + 1;
|
||||
fdistmin = ( (float) distmin * distmin ) * 2; // Distance to center point diagonally
|
||||
distmin = RoutingMatrix.m_GridRouting / 2 + 1;
|
||||
fdistmin = ( (double) distmin * distmin ) * 2; // Distance to center point diagonally
|
||||
|
||||
for( row = row_min; row <= row_max; row++ )
|
||||
{
|
||||
fdisty = (float) ( cy - ( row * Board.m_GridRouting ) );
|
||||
fdisty = (double) ( cy - ( row * RoutingMatrix.m_GridRouting ) );
|
||||
fdisty *= fdisty;
|
||||
|
||||
for( col = col_min; col <= col_max; col++ )
|
||||
{
|
||||
fdistx = (float) ( cx - ( col * Board.m_GridRouting ) );
|
||||
fdistx = (double) ( cx - ( col * RoutingMatrix.m_GridRouting ) );
|
||||
fdistx *= fdistx;
|
||||
|
||||
if( fdistmin <= ( fdistx + fdisty ) )
|
||||
continue;
|
||||
|
||||
if( trace & 1 )
|
||||
WriteCell( row, col, BOTTOM, color );
|
||||
RoutingMatrix.WriteCell( row, col, BOTTOM, color );
|
||||
|
||||
if( trace & 2 )
|
||||
WriteCell( row, col, TOP, color );
|
||||
RoutingMatrix.WriteCell( row, col, TOP, color );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TraceSegmentPcb( BOARD* aPcb, TRACK* pt_segm, int color, int marge, int op_logic )
|
||||
void TraceSegmentPcb( TRACK* pt_segm, int color, int marge, int op_logic )
|
||||
{
|
||||
int half_width;
|
||||
int ux0, uy0, ux1, uy1;
|
||||
|
@ -297,10 +265,10 @@ void TraceSegmentPcb( BOARD* aPcb, TRACK* pt_segm, int color, int marge, int op_
|
|||
half_width = ( pt_segm->m_Width / 2 ) + marge;
|
||||
|
||||
// Calculate the bounding rectangle of the segment (if H, V or Via)
|
||||
ux0 = pt_segm->m_Start.x - aPcb->GetBoundingBox().GetX();
|
||||
uy0 = pt_segm->m_Start.y - aPcb->GetBoundingBox().GetY();
|
||||
ux1 = pt_segm->m_End.x - aPcb->GetBoundingBox().GetX();
|
||||
uy1 = pt_segm->m_End.y - aPcb->GetBoundingBox().GetY();
|
||||
ux0 = pt_segm->m_Start.x - RoutingMatrix.GetBrdCoordOrigin().x;
|
||||
uy0 = pt_segm->m_Start.y - RoutingMatrix.GetBrdCoordOrigin().y;
|
||||
ux1 = pt_segm->m_End.x - RoutingMatrix.GetBrdCoordOrigin().x;
|
||||
uy1 = pt_segm->m_End.y - RoutingMatrix.GetBrdCoordOrigin().y;
|
||||
|
||||
// Test if VIA (filled circle was drawn)
|
||||
if( pt_segm->Type() == PCB_VIA_T )
|
||||
|
@ -322,7 +290,7 @@ void TraceSegmentPcb( BOARD* aPcb, TRACK* pt_segm, int color, int marge, int op_
|
|||
mask_layer = -1;
|
||||
|
||||
if( mask_layer )
|
||||
TraceFilledCircle( aPcb, pt_segm->m_Start.x, pt_segm->m_Start.y,
|
||||
TraceFilledCircle( pt_segm->m_Start.x, pt_segm->m_Start.y,
|
||||
half_width, mask_layer, color, op_logic );
|
||||
return;
|
||||
}
|
||||
|
@ -365,45 +333,26 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
|
|||
int dx, dy, lim;
|
||||
int cumul, inc, il, delta;
|
||||
|
||||
void (* WriteCell)( int, int, int, MATRIX_CELL );
|
||||
|
||||
switch( op_logic )
|
||||
{
|
||||
default:
|
||||
case WRITE_CELL:
|
||||
WriteCell = SetCell; break;
|
||||
|
||||
case WRITE_OR_CELL:
|
||||
WriteCell = OrCell; break;
|
||||
|
||||
case WRITE_XOR_CELL:
|
||||
WriteCell = XorCell; break;
|
||||
|
||||
case WRITE_AND_CELL:
|
||||
WriteCell = AndCell; break;
|
||||
|
||||
case WRITE_ADD_CELL:
|
||||
WriteCell = AddCell; break;
|
||||
}
|
||||
RoutingMatrix.SetCellOperation( op_logic );
|
||||
|
||||
if( x0 == x1 ) // Vertical.
|
||||
{
|
||||
if( y1 < y0 )
|
||||
EXCHG( y0, y1 );
|
||||
|
||||
dy = y0 / Board.m_GridRouting;
|
||||
lim = y1 / Board.m_GridRouting;
|
||||
dx = x0 / Board.m_GridRouting;
|
||||
dy = y0 / RoutingMatrix.m_GridRouting;
|
||||
lim = y1 / RoutingMatrix.m_GridRouting;
|
||||
dx = x0 / RoutingMatrix.m_GridRouting;
|
||||
|
||||
// Clipping limits of board.
|
||||
if( ( dx < 0 ) || ( dx >= Ncols ) )
|
||||
if( ( dx < 0 ) || ( dx >= RoutingMatrix.m_Ncols ) )
|
||||
return;
|
||||
|
||||
if( dy < 0 )
|
||||
dy = 0;
|
||||
|
||||
if( lim >= Nrows )
|
||||
lim = Nrows - 1;
|
||||
if( lim >= RoutingMatrix.m_Nrows )
|
||||
lim = RoutingMatrix.m_Nrows - 1;
|
||||
|
||||
for( ; dy <= lim; dy++ )
|
||||
{
|
||||
|
@ -418,19 +367,19 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
|
|||
if( x1 < x0 )
|
||||
EXCHG( x0, x1 );
|
||||
|
||||
dx = x0 / Board.m_GridRouting;
|
||||
lim = x1 / Board.m_GridRouting;
|
||||
dy = y0 / Board.m_GridRouting;
|
||||
dx = x0 / RoutingMatrix.m_GridRouting;
|
||||
lim = x1 / RoutingMatrix.m_GridRouting;
|
||||
dy = y0 / RoutingMatrix.m_GridRouting;
|
||||
|
||||
// Clipping limits of board.
|
||||
if( ( dy < 0 ) || ( dy >= Nrows ) )
|
||||
if( ( dy < 0 ) || ( dy >= RoutingMatrix.m_Nrows ) )
|
||||
return;
|
||||
|
||||
if( dx < 0 )
|
||||
dx = 0;
|
||||
|
||||
if( lim >= Ncols )
|
||||
lim = Ncols - 1;
|
||||
if( lim >= RoutingMatrix.m_Ncols )
|
||||
lim = RoutingMatrix.m_Ncols - 1;
|
||||
|
||||
for( ; dx <= lim; dx++ )
|
||||
{
|
||||
|
@ -448,20 +397,20 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
|
|||
EXCHG( x1, x0 ); EXCHG( y1, y0 );
|
||||
}
|
||||
|
||||
dx = x0 / Board.m_GridRouting;
|
||||
lim = x1 / Board.m_GridRouting;
|
||||
dy = y0 / Board.m_GridRouting;
|
||||
dx = x0 / RoutingMatrix.m_GridRouting;
|
||||
lim = x1 / RoutingMatrix.m_GridRouting;
|
||||
dy = y0 / RoutingMatrix.m_GridRouting;
|
||||
inc = 1;
|
||||
|
||||
if( y1 < y0 )
|
||||
inc = -1;
|
||||
|
||||
il = lim - dx; cumul = il / 2;
|
||||
delta = abs( y1 - y0 ) / Board.m_GridRouting;
|
||||
delta = abs( y1 - y0 ) / RoutingMatrix.m_GridRouting;
|
||||
|
||||
for( ; dx <= lim; )
|
||||
{
|
||||
if( ( dx >= 0 ) && ( dy >= 0 ) && ( dx < Ncols ) && ( dy < Nrows ) )
|
||||
if( ( dx >= 0 ) && ( dy >= 0 ) && ( dx < RoutingMatrix.m_Ncols ) && ( dy < RoutingMatrix.m_Nrows ) )
|
||||
{
|
||||
OP_CELL( layer, dy, dx );
|
||||
}
|
||||
|
@ -484,20 +433,21 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
|
|||
EXCHG( y1, y0 );
|
||||
}
|
||||
|
||||
dy = y0 / Board.m_GridRouting;
|
||||
lim = y1 / Board.m_GridRouting;
|
||||
dx = x0 / Board.m_GridRouting;
|
||||
dy = y0 / RoutingMatrix.m_GridRouting;
|
||||
lim = y1 / RoutingMatrix.m_GridRouting;
|
||||
dx = x0 / RoutingMatrix.m_GridRouting;
|
||||
inc = 1;
|
||||
|
||||
if( x1 < x0 )
|
||||
inc = -1;
|
||||
|
||||
il = lim - dy; cumul = il / 2;
|
||||
delta = abs( x1 - x0 ) / Board.m_GridRouting;
|
||||
il = lim - dy;
|
||||
cumul = il / 2;
|
||||
delta = abs( x1 - x0 ) / RoutingMatrix.m_GridRouting;
|
||||
|
||||
for( ; dy <= lim; )
|
||||
{
|
||||
if( ( dx >= 0 ) && ( dy >= 0 ) && ( dx < Ncols ) && ( dy < Nrows ) )
|
||||
if( ( dx >= 0 ) && ( dy >= 0 ) && ( dx < RoutingMatrix.m_Ncols ) && ( dy < RoutingMatrix.m_Nrows ) )
|
||||
{
|
||||
OP_CELL( layer, dy, dx );
|
||||
}
|
||||
|
@ -515,15 +465,13 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
|
|||
}
|
||||
|
||||
|
||||
void TraceFilledRectangle( BOARD* aPcb, int ux0, int uy0, int ux1, int uy1,
|
||||
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
|
||||
int aLayerMask, int color, int op_logic )
|
||||
{
|
||||
int row, col;
|
||||
int row_min, row_max, col_min, col_max;
|
||||
int trace = 0;
|
||||
|
||||
void (* WriteCell)( int, int, int, MATRIX_CELL );
|
||||
|
||||
if( ( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) ) )
|
||||
trace = 1; // Trace on BOTTOM
|
||||
|
||||
|
@ -533,75 +481,53 @@ void TraceFilledRectangle( BOARD* aPcb, int ux0, int uy0, int ux1, int uy1,
|
|||
if( trace == 0 )
|
||||
return;
|
||||
|
||||
switch( op_logic )
|
||||
{
|
||||
default:
|
||||
case WRITE_CELL:
|
||||
WriteCell = SetCell;
|
||||
break;
|
||||
RoutingMatrix.SetCellOperation( op_logic );
|
||||
|
||||
case WRITE_OR_CELL:
|
||||
WriteCell = OrCell;
|
||||
break;
|
||||
|
||||
case WRITE_XOR_CELL:
|
||||
WriteCell = XorCell;
|
||||
break;
|
||||
|
||||
case WRITE_AND_CELL:
|
||||
WriteCell = AndCell;
|
||||
break;
|
||||
|
||||
case WRITE_ADD_CELL:
|
||||
WriteCell = AddCell;
|
||||
break;
|
||||
}
|
||||
|
||||
ux0 -= aPcb->GetBoundingBox().GetX();
|
||||
uy0 -= aPcb->GetBoundingBox().GetY();
|
||||
ux1 -= aPcb->GetBoundingBox().GetX();
|
||||
uy1 -= aPcb->GetBoundingBox().GetY();
|
||||
ux0 -= RoutingMatrix.GetBrdCoordOrigin().x;
|
||||
uy0 -= RoutingMatrix.GetBrdCoordOrigin().y;
|
||||
ux1 -= RoutingMatrix.GetBrdCoordOrigin().x;
|
||||
uy1 -= RoutingMatrix.GetBrdCoordOrigin().y;
|
||||
|
||||
// Calculating limits coord cells belonging to the rectangle.
|
||||
row_max = uy1 / Board.m_GridRouting;
|
||||
col_max = ux1 / Board.m_GridRouting;
|
||||
row_min = uy0 / Board.m_GridRouting;
|
||||
row_max = uy1 / RoutingMatrix.m_GridRouting;
|
||||
col_max = ux1 / RoutingMatrix.m_GridRouting;
|
||||
row_min = uy0 / RoutingMatrix.m_GridRouting;
|
||||
|
||||
if( uy0 > row_min * Board.m_GridRouting )
|
||||
if( uy0 > row_min * RoutingMatrix.m_GridRouting )
|
||||
row_min++;
|
||||
|
||||
col_min = ux0 / Board.m_GridRouting;
|
||||
col_min = ux0 / RoutingMatrix.m_GridRouting;
|
||||
|
||||
if( ux0 > col_min * Board.m_GridRouting )
|
||||
if( ux0 > col_min * RoutingMatrix.m_GridRouting )
|
||||
col_min++;
|
||||
|
||||
if( row_min < 0 )
|
||||
row_min = 0;
|
||||
|
||||
if( row_max >= ( Nrows - 1 ) )
|
||||
row_max = Nrows - 1;
|
||||
if( row_max >= ( RoutingMatrix.m_Nrows - 1 ) )
|
||||
row_max = RoutingMatrix.m_Nrows - 1;
|
||||
|
||||
if( col_min < 0 )
|
||||
col_min = 0;
|
||||
|
||||
if( col_max >= ( Ncols - 1 ) )
|
||||
col_max = Ncols - 1;
|
||||
if( col_max >= ( RoutingMatrix.m_Ncols - 1 ) )
|
||||
col_max = RoutingMatrix.m_Ncols - 1;
|
||||
|
||||
for( row = row_min; row <= row_max; row++ )
|
||||
{
|
||||
for( col = col_min; col <= col_max; col++ )
|
||||
{
|
||||
if( trace & 1 )
|
||||
WriteCell( row, col, BOTTOM, color );
|
||||
RoutingMatrix.WriteCell( row, col, BOTTOM, color );
|
||||
|
||||
if( trace & 2 )
|
||||
WriteCell( row, col, TOP, color );
|
||||
RoutingMatrix.WriteCell( row, col, TOP, color );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TraceFilledRectangle( BOARD* aPcb, int ux0, int uy0, int ux1, int uy1,
|
||||
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
|
||||
int angle, int aLayerMask, int color, int op_logic )
|
||||
{
|
||||
int row, col;
|
||||
|
@ -611,8 +537,6 @@ void TraceFilledRectangle( BOARD* aPcb, int ux0, int uy0, int ux1, int uy1,
|
|||
int rotrow, rotcol;
|
||||
int trace = 0;
|
||||
|
||||
void (* WriteCell)( int, int, int, MATRIX_CELL );
|
||||
|
||||
if( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) )
|
||||
trace = 1; // Trace on BOTTOM
|
||||
|
||||
|
@ -625,34 +549,12 @@ void TraceFilledRectangle( BOARD* aPcb, int ux0, int uy0, int ux1, int uy1,
|
|||
if( trace == 0 )
|
||||
return;
|
||||
|
||||
switch( op_logic )
|
||||
{
|
||||
default:
|
||||
case WRITE_CELL:
|
||||
WriteCell = SetCell;
|
||||
break;
|
||||
RoutingMatrix.SetCellOperation( op_logic );
|
||||
|
||||
case WRITE_OR_CELL:
|
||||
WriteCell = OrCell;
|
||||
break;
|
||||
|
||||
case WRITE_XOR_CELL:
|
||||
WriteCell = XorCell;
|
||||
break;
|
||||
|
||||
case WRITE_AND_CELL:
|
||||
WriteCell = AndCell;
|
||||
break;
|
||||
|
||||
case WRITE_ADD_CELL:
|
||||
WriteCell = AddCell;
|
||||
break;
|
||||
}
|
||||
|
||||
ux0 -= aPcb->GetBoundingBox().GetX();
|
||||
uy0 -= aPcb->GetBoundingBox().GetY();
|
||||
ux1 -= aPcb->GetBoundingBox().GetX();
|
||||
uy1 -= aPcb->GetBoundingBox().GetY();
|
||||
ux0 -= RoutingMatrix.GetBrdCoordOrigin().x;
|
||||
uy0 -= RoutingMatrix.GetBrdCoordOrigin().y;
|
||||
ux1 -= RoutingMatrix.GetBrdCoordOrigin().x;
|
||||
uy1 -= RoutingMatrix.GetBrdCoordOrigin().y;
|
||||
|
||||
cx = (ux0 + ux1) / 2;
|
||||
cy = (uy0 + uy1) / 2;
|
||||
|
@ -660,36 +562,36 @@ void TraceFilledRectangle( BOARD* aPcb, int ux0, int uy0, int ux1, int uy1,
|
|||
+ (double) ( cy - uy0 ) * ( cy - uy0 ) );
|
||||
|
||||
// Calculating coordinate limits belonging to the rectangle.
|
||||
row_max = ( cy + radius ) / Board.m_GridRouting;
|
||||
col_max = ( cx + radius ) / Board.m_GridRouting;
|
||||
row_min = ( cy - radius ) / Board.m_GridRouting;
|
||||
row_max = ( cy + radius ) / RoutingMatrix.m_GridRouting;
|
||||
col_max = ( cx + radius ) / RoutingMatrix.m_GridRouting;
|
||||
row_min = ( cy - radius ) / RoutingMatrix.m_GridRouting;
|
||||
|
||||
if( uy0 > row_min * Board.m_GridRouting )
|
||||
if( uy0 > row_min * RoutingMatrix.m_GridRouting )
|
||||
row_min++;
|
||||
|
||||
col_min = ( cx - radius ) / Board.m_GridRouting;
|
||||
col_min = ( cx - radius ) / RoutingMatrix.m_GridRouting;
|
||||
|
||||
if( ux0 > col_min * Board.m_GridRouting )
|
||||
if( ux0 > col_min * RoutingMatrix.m_GridRouting )
|
||||
col_min++;
|
||||
|
||||
if( row_min < 0 )
|
||||
row_min = 0;
|
||||
|
||||
if( row_max >= ( Nrows - 1 ) )
|
||||
row_max = Nrows - 1;
|
||||
if( row_max >= ( RoutingMatrix.m_Nrows - 1 ) )
|
||||
row_max = RoutingMatrix.m_Nrows - 1;
|
||||
|
||||
if( col_min < 0 )
|
||||
col_min = 0;
|
||||
|
||||
if( col_max >= ( Ncols - 1 ) )
|
||||
col_max = Ncols - 1;
|
||||
if( col_max >= ( RoutingMatrix.m_Ncols - 1 ) )
|
||||
col_max = RoutingMatrix.m_Ncols - 1;
|
||||
|
||||
for( row = row_min; row <= row_max; row++ )
|
||||
{
|
||||
for( col = col_min; col <= col_max; col++ )
|
||||
{
|
||||
rotrow = row * Board.m_GridRouting;
|
||||
rotcol = col * Board.m_GridRouting;
|
||||
rotrow = row * RoutingMatrix.m_GridRouting;
|
||||
rotcol = col * RoutingMatrix.m_GridRouting;
|
||||
RotatePoint( &rotcol, &rotrow, cx, cy, -angle );
|
||||
|
||||
if( rotrow <= uy0 )
|
||||
|
@ -705,19 +607,18 @@ void TraceFilledRectangle( BOARD* aPcb, int ux0, int uy0, int ux1, int uy1,
|
|||
continue;
|
||||
|
||||
if( trace & 1 )
|
||||
WriteCell( row, col, BOTTOM, color );
|
||||
RoutingMatrix.WriteCell( row, col, BOTTOM, color );
|
||||
|
||||
if( trace & 2 )
|
||||
WriteCell( row, col, TOP, color );
|
||||
RoutingMatrix.WriteCell( row, col, TOP, color );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Fills all cells inside a segment
|
||||
* half-width lg, org ux, ux end y0, y1
|
||||
* is set to color.
|
||||
* coordinates are in PCB units (0.1 mil) are relative to the Board
|
||||
* half-width = lg, org = ux0,uy0 end = ux1,uy1
|
||||
* coordinates are in PCB units
|
||||
*/
|
||||
void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
|
||||
int color, int op_logic )
|
||||
|
@ -727,33 +628,10 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
|
|||
int row_max, col_max, row_min, col_min;
|
||||
int demi_pas;
|
||||
|
||||
void (* WriteCell)( int, int, int, MATRIX_CELL );
|
||||
int angle;
|
||||
int cx, cy, dx, dy;
|
||||
|
||||
switch( op_logic )
|
||||
{
|
||||
default:
|
||||
case WRITE_CELL:
|
||||
WriteCell = SetCell;
|
||||
break;
|
||||
|
||||
case WRITE_OR_CELL:
|
||||
WriteCell = OrCell;
|
||||
break;
|
||||
|
||||
case WRITE_XOR_CELL:
|
||||
WriteCell = XorCell;
|
||||
break;
|
||||
|
||||
case WRITE_AND_CELL:
|
||||
WriteCell = AndCell;
|
||||
break;
|
||||
|
||||
case WRITE_ADD_CELL:
|
||||
WriteCell = AddCell;
|
||||
break;
|
||||
}
|
||||
RoutingMatrix.SetCellOperation( op_logic );
|
||||
|
||||
// Make coordinate ux1 tj > ux0 to simplify calculations
|
||||
if( ux1 < ux0 )
|
||||
|
@ -768,40 +646,40 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
|
|||
if( uy1 < uy0 )
|
||||
inc = -1;
|
||||
|
||||
demi_pas = Board.m_GridRouting / 2;
|
||||
demi_pas = RoutingMatrix.m_GridRouting / 2;
|
||||
|
||||
col_min = ( ux0 - lg ) / Board.m_GridRouting;
|
||||
col_min = ( ux0 - lg ) / RoutingMatrix.m_GridRouting;
|
||||
|
||||
if( col_min < 0 )
|
||||
col_min = 0;
|
||||
|
||||
col_max = ( ux1 + lg + demi_pas ) / Board.m_GridRouting;
|
||||
col_max = ( ux1 + lg + demi_pas ) / RoutingMatrix.m_GridRouting;
|
||||
|
||||
if( col_max > ( Ncols - 1 ) )
|
||||
col_max = Ncols - 1;
|
||||
if( col_max > ( RoutingMatrix.m_Ncols - 1 ) )
|
||||
col_max = RoutingMatrix.m_Ncols - 1;
|
||||
|
||||
if( inc > 0 )
|
||||
{
|
||||
row_min = ( uy0 - lg ) / Board.m_GridRouting;
|
||||
row_max = ( uy1 + lg + demi_pas ) / Board.m_GridRouting;
|
||||
row_min = ( uy0 - lg ) / RoutingMatrix.m_GridRouting;
|
||||
row_max = ( uy1 + lg + demi_pas ) / RoutingMatrix.m_GridRouting;
|
||||
}
|
||||
else
|
||||
{
|
||||
row_min = ( uy1 - lg ) / Board.m_GridRouting;
|
||||
row_max = ( uy0 + lg + demi_pas ) / Board.m_GridRouting;
|
||||
row_min = ( uy1 - lg ) / RoutingMatrix.m_GridRouting;
|
||||
row_max = ( uy0 + lg + demi_pas ) / RoutingMatrix.m_GridRouting;
|
||||
}
|
||||
|
||||
if( row_min < 0 )
|
||||
row_min = 0;
|
||||
|
||||
if( row_min > ( Nrows - 1 ) )
|
||||
row_min = Nrows - 1;
|
||||
if( row_min > ( RoutingMatrix.m_Nrows - 1 ) )
|
||||
row_min = RoutingMatrix.m_Nrows - 1;
|
||||
|
||||
if( row_max < 0 )
|
||||
row_max = 0;
|
||||
|
||||
if( row_max > ( Nrows - 1 ) )
|
||||
row_max = Nrows - 1;
|
||||
if( row_max > ( RoutingMatrix.m_Nrows - 1 ) )
|
||||
row_max = RoutingMatrix.m_Nrows - 1;
|
||||
|
||||
dx = ux1 - ux0;
|
||||
dy = uy1 - uy0;
|
||||
|
@ -823,11 +701,11 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
|
|||
for( col = col_min; col <= col_max; col++ )
|
||||
{
|
||||
int cxr;
|
||||
cxr = ( col * Board.m_GridRouting ) - ux0;
|
||||
cxr = ( col * RoutingMatrix.m_GridRouting ) - ux0;
|
||||
|
||||
for( row = row_min; row <= row_max; row++ )
|
||||
{
|
||||
cy = (row * Board.m_GridRouting) - uy0;
|
||||
cy = (row * RoutingMatrix.m_GridRouting) - uy0;
|
||||
cx = cxr;
|
||||
RotatePoint( &cx, &cy, angle );
|
||||
|
||||
|
@ -864,10 +742,9 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
|
|||
}
|
||||
|
||||
|
||||
/* Fills all cells BOARD contained in the circle
|
||||
* half-width lg center ux, ux through y0, y1 is set to color.
|
||||
* coord in PCB units (0.1 million) relating to the origin
|
||||
* pt_pcb-> m_PcbBox.m_Xmin, Y's board.
|
||||
/* Fills all cells of the routing matrix contained in the circle
|
||||
* half-width = lg, center = ux0, uy0, ux1,uy1 is a point on the circle.
|
||||
* coord are in PCB units.
|
||||
*/
|
||||
void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
|
||||
int color, int op_logic )
|
||||
|
@ -908,9 +785,10 @@ void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
|
|||
}
|
||||
|
||||
|
||||
/* Fills all BOARD cells contained in the arc of "L" angle half-width lg
|
||||
* ux center, starting in ux y0, y1 is set to color. Coordinates are in
|
||||
* PCB units (0.1 mil) relating to the origin pt_pcb-> Pcb_oX, Y's board.
|
||||
/* Fills all routing matrix cells contained in the arc
|
||||
* angle = ArcAngle, half-width lg
|
||||
* center = ux0,uy0, starting at ux1, uy1. Coordinates are in
|
||||
* PCB units.
|
||||
*/
|
||||
void TraceArc( int ux0, int uy0, int ux1, int uy1, int ArcAngle, int lg,
|
||||
int layer, int color, int op_logic )
|
|
@ -1,9 +1,13 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* First copyright (C) Randy Nevin, 1989 (see PCBCA package)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -23,6 +27,7 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @file queue.cpp
|
||||
*/
|
|
@ -1,9 +1,11 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
*
|
||||
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -34,7 +36,7 @@
|
|||
|
||||
#include <pcbnew.h>
|
||||
#include <cell.h>
|
||||
#include <ar_protos.h>
|
||||
#include <autorout.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
|
@ -44,14 +46,15 @@
|
|||
#include <class_pcb_text.h>
|
||||
|
||||
|
||||
bool MATRIX_ROUTING_HEAD::ComputeMatrixSize( BOARD* aPcb )
|
||||
bool MATRIX_ROUTING_HEAD::ComputeMatrixSize( BOARD* aPcb, bool aUseBoardEdgesOnly )
|
||||
{
|
||||
aPcb->ComputeBoundingBox();
|
||||
aPcb->ComputeBoundingBox( aUseBoardEdgesOnly );
|
||||
|
||||
// The boundary box must have its start point on routing grid:
|
||||
m_BrdBox = aPcb->GetBoundingBox();
|
||||
|
||||
m_BrdBox.Offset( -(m_BrdBox.GetX() % m_GridRouting), -(m_BrdBox.GetY() % m_GridRouting) );
|
||||
m_BrdBox.SetX( m_BrdBox.GetX() - ( m_BrdBox.GetX() % m_GridRouting ) );
|
||||
m_BrdBox.SetY( m_BrdBox.GetY() - ( m_BrdBox.GetY() % m_GridRouting ) );
|
||||
|
||||
// The boundary box must have its end point on routing grid:
|
||||
wxPoint end = m_BrdBox.GetEnd();
|
||||
|
@ -66,12 +69,12 @@ bool MATRIX_ROUTING_HEAD::ComputeMatrixSize( BOARD* aPcb )
|
|||
|
||||
aPcb->SetBoundingBox( m_BrdBox );
|
||||
|
||||
m_Nrows = Nrows = m_BrdBox.GetHeight() / m_GridRouting;
|
||||
m_Ncols = Ncols = m_BrdBox.GetWidth() / m_GridRouting;
|
||||
m_Nrows = m_BrdBox.GetHeight() / m_GridRouting;
|
||||
m_Ncols = m_BrdBox.GetWidth() / m_GridRouting;
|
||||
|
||||
/* get a small margin for memory allocation: */
|
||||
Ncols += 1;
|
||||
Nrows += 1;
|
||||
// gives a small margin
|
||||
m_Ncols += 1;
|
||||
m_Nrows += 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -79,10 +82,10 @@ bool MATRIX_ROUTING_HEAD::ComputeMatrixSize( BOARD* aPcb )
|
|||
|
||||
MATRIX_ROUTING_HEAD::MATRIX_ROUTING_HEAD()
|
||||
{
|
||||
m_BoardSide[0] = m_BoardSide[1] = NULL;
|
||||
m_DistSide[0] = m_DistSide[1] = NULL;
|
||||
m_DirSide[0] = m_DirSide[1] = NULL;
|
||||
m_InitBoardDone = false;
|
||||
m_BoardSide[0] = m_BoardSide[1] = NULL;
|
||||
m_DistSide[0] = m_DistSide[1] = NULL;
|
||||
m_DirSide[0] = m_DirSide[1] = NULL;
|
||||
m_InitMatrixDone = false;
|
||||
m_Layers = MAX_SIDES_COUNT;
|
||||
m_Nrows = m_Ncols = 0;
|
||||
m_MemSize = 0;
|
||||
|
@ -94,18 +97,17 @@ MATRIX_ROUTING_HEAD::~MATRIX_ROUTING_HEAD()
|
|||
}
|
||||
|
||||
|
||||
int MATRIX_ROUTING_HEAD::InitBoard()
|
||||
int MATRIX_ROUTING_HEAD::InitRoutingMatrix()
|
||||
{
|
||||
int ii, kk;
|
||||
|
||||
if( Nrows <= 0 || Ncols <= 0 )
|
||||
if( m_Nrows <= 0 || m_Ncols <= 0 )
|
||||
return 0;
|
||||
m_Nrows = Nrows;
|
||||
m_Ncols = Ncols;
|
||||
|
||||
m_InitBoardDone = true; /* we have been called */
|
||||
m_InitMatrixDone = true; // we have been called
|
||||
|
||||
ii = (Nrows + 1) * (Ncols + 1);
|
||||
// give a small margin for memory allocation:
|
||||
ii = (RoutingMatrix.m_Nrows + 1) * (RoutingMatrix.m_Ncols + 1);
|
||||
|
||||
for( kk = 0; kk < m_Layers; kk++ )
|
||||
{
|
||||
|
@ -113,21 +115,21 @@ int MATRIX_ROUTING_HEAD::InitBoard()
|
|||
m_DistSide[kk] = NULL;
|
||||
m_DirSide[kk] = NULL;
|
||||
|
||||
/* allocate Board & initialize everything to empty */
|
||||
/* allocate matrix & initialize everything to empty */
|
||||
m_BoardSide[kk] = (MATRIX_CELL*) operator new( ii * sizeof(MATRIX_CELL) );
|
||||
memset( m_BoardSide[kk], 0, ii * sizeof(MATRIX_CELL) );
|
||||
|
||||
if( m_BoardSide[kk] == NULL )
|
||||
return -1;
|
||||
|
||||
/***** allocate Distances *****/
|
||||
// allocate Distances
|
||||
m_DistSide[kk] = (DIST_CELL*) operator new( ii * sizeof(DIST_CELL) );
|
||||
memset( m_DistSide[kk], 0, ii * sizeof(DIST_CELL) );
|
||||
|
||||
if( m_DistSide[kk] == NULL )
|
||||
return -1;
|
||||
|
||||
/***** allocate Dir (chars) *****/
|
||||
// allocate Dir (chars)
|
||||
m_DirSide[kk] = (char*) operator new( ii );
|
||||
memset( m_DirSide[kk], 0, ii );
|
||||
|
||||
|
@ -141,29 +143,29 @@ int MATRIX_ROUTING_HEAD::InitBoard()
|
|||
}
|
||||
|
||||
|
||||
void MATRIX_ROUTING_HEAD::UnInitBoard()
|
||||
void MATRIX_ROUTING_HEAD::UnInitRoutingMatrix()
|
||||
{
|
||||
int ii;
|
||||
|
||||
m_InitBoardDone = false;
|
||||
m_InitMatrixDone = false;
|
||||
|
||||
for( ii = 0; ii < MAX_SIDES_COUNT; ii++ )
|
||||
{
|
||||
/***** de-allocate Dir matrix *****/
|
||||
// de-allocate Dir matrix
|
||||
if( m_DirSide[ii] )
|
||||
{
|
||||
delete m_DirSide[ii];
|
||||
m_DirSide[ii] = NULL;
|
||||
}
|
||||
|
||||
/***** de-allocate Distances matrix *****/
|
||||
// de-allocate Distances matrix
|
||||
if( m_DistSide[ii] )
|
||||
{
|
||||
delete m_DistSide[ii];
|
||||
m_DistSide[ii] = NULL;
|
||||
}
|
||||
|
||||
/**** de-allocate cells matrix *****/
|
||||
// de-allocate cells matrix
|
||||
if( m_BoardSide[ii] )
|
||||
{
|
||||
delete m_BoardSide[ii];
|
||||
|
@ -209,10 +211,10 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
|||
|
||||
if( net_code != pad->GetNet() || (flag & FORCE_PADS) )
|
||||
{
|
||||
::PlacePad( aPcb, pad, HOLE, marge, WRITE_CELL );
|
||||
::PlacePad( pad, HOLE, marge, WRITE_CELL );
|
||||
}
|
||||
|
||||
::PlacePad( aPcb, pad, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||
::PlacePad( pad, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||
}
|
||||
|
||||
// Place outlines of modules on matrix routing, if they are on a copper layer
|
||||
|
@ -241,8 +243,8 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
|||
tmpSegm.m_Param = edge->GetAngle();
|
||||
tmpSegm.SetNet( -1 );
|
||||
|
||||
TraceSegmentPcb( aPcb, &tmpSegm, HOLE, marge, WRITE_CELL );
|
||||
TraceSegmentPcb( aPcb, &tmpSegm, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||
TraceSegmentPcb( &tmpSegm, HOLE, marge, WRITE_CELL );
|
||||
TraceSegmentPcb( &tmpSegm, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -278,7 +280,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
|||
tmpSegm.m_Param = DrawSegm->GetAngle();
|
||||
tmpSegm.SetNet( -1 );
|
||||
|
||||
TraceSegmentPcb( aPcb, &tmpSegm, type_cell, marge, WRITE_CELL );
|
||||
TraceSegmentPcb( &tmpSegm, type_cell, marge, WRITE_CELL );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -308,11 +310,11 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
|||
|
||||
layerMask = GetLayerMask( PtText->GetLayer() );
|
||||
|
||||
TraceFilledRectangle( aPcb, ux0 - marge, uy0 - marge, ux1 + marge,
|
||||
TraceFilledRectangle( ux0 - marge, uy0 - marge, ux1 + marge,
|
||||
uy1 + marge, (int) (PtText->m_Orient),
|
||||
layerMask, HOLE, WRITE_CELL );
|
||||
|
||||
TraceFilledRectangle( aPcb, ux0 - via_marge, uy0 - via_marge,
|
||||
TraceFilledRectangle( ux0 - via_marge, uy0 - via_marge,
|
||||
ux1 + via_marge, uy1 + via_marge,
|
||||
(int) (PtText->m_Orient),
|
||||
layerMask, VIA_IMPOSSIBLE, WRITE_OR_CELL );
|
||||
|
@ -330,8 +332,8 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
|||
if( net_code == track->GetNet() )
|
||||
continue;
|
||||
|
||||
TraceSegmentPcb( aPcb, track, HOLE, marge, WRITE_CELL );
|
||||
TraceSegmentPcb( aPcb, track, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||
TraceSegmentPcb( track, HOLE, marge, WRITE_CELL );
|
||||
TraceSegmentPcb( track, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -342,13 +344,13 @@ int Build_Work( BOARD* Pcb )
|
|||
D_PAD* pt_pad;
|
||||
int r1, r2, c1, c2, current_net_code;
|
||||
RATSNEST_ITEM* pt_ch;
|
||||
int demi_pas = Board.m_GridRouting / 2;
|
||||
int demi_pas = RoutingMatrix.m_GridRouting / 2;
|
||||
wxString msg;
|
||||
|
||||
EDA_RECT bbbox = Pcb->GetBoundingBox();
|
||||
|
||||
InitWork(); /* clear work list */
|
||||
Ntotal = 0;
|
||||
int cellCount = 0;
|
||||
|
||||
for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ )
|
||||
{
|
||||
|
@ -371,9 +373,9 @@ int Build_Work( BOARD* Pcb )
|
|||
current_net_code = pt_pad->GetNet();
|
||||
pt_ch = pt_rats;
|
||||
|
||||
r1 = ( pt_pad->GetPosition().y - bbbox.GetY() + demi_pas ) / Board.m_GridRouting;
|
||||
r1 = ( pt_pad->GetPosition().y - bbbox.GetY() + demi_pas ) / RoutingMatrix.m_GridRouting;
|
||||
|
||||
if( r1 < 0 || r1 >= Nrows )
|
||||
if( r1 < 0 || r1 >= RoutingMatrix.m_Nrows )
|
||||
{
|
||||
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r1,
|
||||
pt_pad->GetPosition().y, bbbox.GetY() );
|
||||
|
@ -381,9 +383,9 @@ int Build_Work( BOARD* Pcb )
|
|||
return 0;
|
||||
}
|
||||
|
||||
c1 = ( pt_pad->GetPosition().x - bbbox.GetX() + demi_pas ) / Board.m_GridRouting;
|
||||
c1 = ( pt_pad->GetPosition().x - bbbox.GetX() + demi_pas ) / RoutingMatrix.m_GridRouting;
|
||||
|
||||
if( c1 < 0 || c1 >= Ncols )
|
||||
if( c1 < 0 || c1 >= RoutingMatrix.m_Ncols )
|
||||
{
|
||||
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c1,
|
||||
pt_pad->GetPosition().x, bbbox.GetX() );
|
||||
|
@ -394,9 +396,9 @@ int Build_Work( BOARD* Pcb )
|
|||
pt_pad = pt_rats->m_PadEnd;
|
||||
|
||||
r2 = ( pt_pad->GetPosition().y - bbbox.GetY()
|
||||
+ demi_pas ) / Board.m_GridRouting;
|
||||
+ demi_pas ) / RoutingMatrix.m_GridRouting;
|
||||
|
||||
if( r2 < 0 || r2 >= Nrows )
|
||||
if( r2 < 0 || r2 >= RoutingMatrix.m_Nrows )
|
||||
{
|
||||
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r2,
|
||||
pt_pad->GetPosition().y, bbbox.GetY() );
|
||||
|
@ -404,9 +406,9 @@ int Build_Work( BOARD* Pcb )
|
|||
return 0;
|
||||
}
|
||||
|
||||
c2 = ( pt_pad->GetPosition().x - bbbox.GetX() + demi_pas ) / Board.m_GridRouting;
|
||||
c2 = ( pt_pad->GetPosition().x - bbbox.GetX() + demi_pas ) / RoutingMatrix.m_GridRouting;
|
||||
|
||||
if( c2 < 0 || c2 >= Ncols )
|
||||
if( c2 < 0 || c2 >= RoutingMatrix.m_Ncols )
|
||||
{
|
||||
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c2,
|
||||
pt_pad->GetPosition().x, bbbox.GetX() );
|
||||
|
@ -415,115 +417,143 @@ int Build_Work( BOARD* Pcb )
|
|||
}
|
||||
|
||||
SetWork( r1, c1, current_net_code, r2, c2, pt_ch, 0 );
|
||||
Ntotal++;
|
||||
cellCount++;
|
||||
}
|
||||
|
||||
SortWork();
|
||||
return Ntotal;
|
||||
return cellCount;
|
||||
}
|
||||
|
||||
// Initialize WriteCell to make the aLogicOp
|
||||
void MATRIX_ROUTING_HEAD::SetCellOperation( int aLogicOp )
|
||||
{
|
||||
switch( aLogicOp )
|
||||
{
|
||||
default:
|
||||
case WRITE_CELL:
|
||||
m_opWriteCell = &MATRIX_ROUTING_HEAD::SetCell;
|
||||
break;
|
||||
|
||||
case WRITE_OR_CELL:
|
||||
m_opWriteCell = &MATRIX_ROUTING_HEAD::OrCell;
|
||||
break;
|
||||
|
||||
case WRITE_XOR_CELL:
|
||||
m_opWriteCell = &MATRIX_ROUTING_HEAD::XorCell;
|
||||
break;
|
||||
|
||||
case WRITE_AND_CELL:
|
||||
m_opWriteCell = &MATRIX_ROUTING_HEAD::AndCell;
|
||||
break;
|
||||
|
||||
case WRITE_ADD_CELL:
|
||||
m_opWriteCell = &MATRIX_ROUTING_HEAD::AddCell;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* return the value stored in a cell
|
||||
*/
|
||||
MATRIX_CELL GetCell( int aRow, int aCol, int aSide )
|
||||
MATRIX_CELL MATRIX_ROUTING_HEAD::GetCell( int aRow, int aCol, int aSide )
|
||||
{
|
||||
MATRIX_CELL* p;
|
||||
|
||||
p = Board.m_BoardSide[aSide];
|
||||
return p[aRow * Ncols + aCol];
|
||||
p = RoutingMatrix.m_BoardSide[aSide];
|
||||
return p[aRow * m_Ncols + aCol];
|
||||
}
|
||||
|
||||
|
||||
/* basic cell operation : WRITE operation
|
||||
*/
|
||||
void SetCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
||||
void MATRIX_ROUTING_HEAD::SetCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
||||
{
|
||||
MATRIX_CELL* p;
|
||||
|
||||
p = Board.m_BoardSide[aSide];
|
||||
p[aRow * Ncols + aCol] = x;
|
||||
p = RoutingMatrix.m_BoardSide[aSide];
|
||||
p[aRow * m_Ncols + aCol] = x;
|
||||
}
|
||||
|
||||
|
||||
/* basic cell operation : OR operation
|
||||
*/
|
||||
void OrCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
||||
void MATRIX_ROUTING_HEAD::OrCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
||||
{
|
||||
MATRIX_CELL* p;
|
||||
|
||||
p = Board.m_BoardSide[aSide];
|
||||
p[aRow * Ncols + aCol] |= x;
|
||||
p = RoutingMatrix.m_BoardSide[aSide];
|
||||
p[aRow * m_Ncols + aCol] |= x;
|
||||
}
|
||||
|
||||
|
||||
/* basic cell operation : XOR operation
|
||||
*/
|
||||
void XorCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
||||
void MATRIX_ROUTING_HEAD::XorCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
||||
{
|
||||
MATRIX_CELL* p;
|
||||
|
||||
p = Board.m_BoardSide[aSide];
|
||||
p[aRow * Ncols + aCol] ^= x;
|
||||
p = RoutingMatrix.m_BoardSide[aSide];
|
||||
p[aRow * m_Ncols + aCol] ^= x;
|
||||
}
|
||||
|
||||
|
||||
/* basic cell operation : AND operation
|
||||
*/
|
||||
void AndCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
||||
void MATRIX_ROUTING_HEAD::AndCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
||||
{
|
||||
MATRIX_CELL* p;
|
||||
|
||||
p = Board.m_BoardSide[aSide];
|
||||
p[aRow * Ncols + aCol] &= x;
|
||||
p = RoutingMatrix.m_BoardSide[aSide];
|
||||
p[aRow * m_Ncols + aCol] &= x;
|
||||
}
|
||||
|
||||
|
||||
/* basic cell operation : ADD operation
|
||||
*/
|
||||
void AddCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
||||
void MATRIX_ROUTING_HEAD::AddCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
||||
{
|
||||
MATRIX_CELL* p;
|
||||
|
||||
p = Board.m_BoardSide[aSide];
|
||||
p[aRow * Ncols + aCol] += x;
|
||||
p = RoutingMatrix.m_BoardSide[aSide];
|
||||
p[aRow * m_Ncols + aCol] += x;
|
||||
}
|
||||
|
||||
|
||||
/* fetch distance cell */
|
||||
DIST_CELL GetDist( int aRow, int aCol, int aSide ) /* fetch distance cell */
|
||||
DIST_CELL MATRIX_ROUTING_HEAD::GetDist( int aRow, int aCol, int aSide ) /* fetch distance cell */
|
||||
{
|
||||
DIST_CELL* p;
|
||||
|
||||
p = Board.m_DistSide[aSide];
|
||||
return p[aRow * Ncols + aCol];
|
||||
p = RoutingMatrix.m_DistSide[aSide];
|
||||
return p[aRow * m_Ncols + aCol];
|
||||
}
|
||||
|
||||
|
||||
/* store distance cell */
|
||||
void SetDist( int aRow, int aCol, int aSide, DIST_CELL x )
|
||||
void MATRIX_ROUTING_HEAD::SetDist( int aRow, int aCol, int aSide, DIST_CELL x )
|
||||
{
|
||||
DIST_CELL* p;
|
||||
|
||||
p = Board.m_DistSide[aSide];
|
||||
p[aRow * Ncols + aCol] = x;
|
||||
p = RoutingMatrix.m_DistSide[aSide];
|
||||
p[aRow * m_Ncols + aCol] = x;
|
||||
}
|
||||
|
||||
|
||||
/* fetch direction cell */
|
||||
int GetDir( int aRow, int aCol, int aSide )
|
||||
int MATRIX_ROUTING_HEAD::GetDir( int aRow, int aCol, int aSide )
|
||||
{
|
||||
DIR_CELL* p;
|
||||
|
||||
p = Board.m_DirSide[aSide];
|
||||
return (int) (p[aRow * Ncols + aCol]);
|
||||
p = RoutingMatrix.m_DirSide[aSide];
|
||||
return (int) (p[aRow * m_Ncols + aCol]);
|
||||
}
|
||||
|
||||
|
||||
/* store direction cell */
|
||||
void SetDir( int aRow, int aCol, int aSide, int x )
|
||||
void MATRIX_ROUTING_HEAD::SetDir( int aRow, int aCol, int aSide, int x )
|
||||
{
|
||||
DIR_CELL* p;
|
||||
|
||||
p = Board.m_DirSide[aSide];
|
||||
p[aRow * Ncols + aCol] = (char) x;
|
||||
p = RoutingMatrix.m_DirSide[aSide];
|
||||
p[aRow * m_Ncols + aCol] = (char) x;
|
||||
}
|
|
@ -1,9 +1,12 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
*
|
||||
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* First copyright (C) Randy Nevin, 1989 (see PCBCA package)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -23,6 +26,9 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/* see "Autorouting With the A* Algorithm" (Dr.Dobbs journal)
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file solve.cpp
|
||||
*/
|
||||
|
@ -40,7 +46,7 @@
|
|||
|
||||
#include <pcbnew.h>
|
||||
#include <protos.h>
|
||||
#include <ar_protos.h>
|
||||
#include <autorout.h>
|
||||
#include <cell.h>
|
||||
|
||||
|
||||
|
@ -76,7 +82,6 @@ static int segm_oX, segm_oY;
|
|||
static int segm_fX, segm_fY; /* Origin and position of the current
|
||||
* trace segment. */
|
||||
static RATSNEST_ITEM* pt_cur_ch;
|
||||
static int Ncurrent; /* measures of progress */
|
||||
static int s_Clearance; // Clearance value used in autorouter
|
||||
|
||||
static PICKED_ITEMS_LIST s_ItemsListPicker;
|
||||
|
@ -104,7 +109,7 @@ static PICKED_ITEMS_LIST s_ItemsListPicker;
|
|||
* [] [0] = row [] (1] = col was added to the coord of the midpoint for
|
||||
* Get the coord of the 8 neighboring points.
|
||||
*/
|
||||
static int delta[8][2] =
|
||||
static const int delta[8][2] =
|
||||
{
|
||||
{ 1, -1 }, /* northwest */
|
||||
{ 1, 0 }, /* north */
|
||||
|
@ -116,7 +121,7 @@ static int delta[8][2] =
|
|||
{ -1, 1 } /* southeast */
|
||||
};
|
||||
|
||||
static int ndir[8] =
|
||||
static const int ndir[8] =
|
||||
{
|
||||
/* for building paths back to source */
|
||||
FROM_SOUTHEAST, FROM_SOUTH, FROM_SOUTHWEST,
|
||||
|
@ -266,13 +271,12 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides )
|
|||
NETINFO_ITEM* net;
|
||||
bool stop = false;
|
||||
wxString msg;
|
||||
int routedCount = 0; // routed ratsnest count
|
||||
|
||||
m_canvas->SetAbortRequest( false );
|
||||
|
||||
s_Clearance = GetBoard()->m_NetClasses.GetDefault()->GetClearance();
|
||||
|
||||
Ncurrent = 0;
|
||||
|
||||
// Prepare the undo command info
|
||||
s_ItemsListPicker.ClearListAndDeleteItems(); // Should not be necessary, but...
|
||||
|
||||
|
@ -304,43 +308,33 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides )
|
|||
|
||||
EraseMsgBox();
|
||||
|
||||
Ncurrent++;
|
||||
routedCount++;
|
||||
net = GetBoard()->FindNet( current_net_code );
|
||||
|
||||
if( net )
|
||||
{
|
||||
msg.Printf( wxT( "[%8.8s]" ), GetChars( net->GetNetname() ) );
|
||||
AppendMsgPanel( wxT( "Net route" ), msg, BROWN );
|
||||
msg.Printf( wxT( "%d / %d" ), Ncurrent, Ntotal );
|
||||
msg.Printf( wxT( "%d / %d" ), routedCount, RoutingMatrix.m_RouteCount );
|
||||
AppendMsgPanel( wxT( "Activity" ), msg, BROWN );
|
||||
}
|
||||
|
||||
pt_cur_ch = pt_cur_ch;
|
||||
segm_oX = GetBoard()->GetBoundingBox().GetX() + (Board.m_GridRouting * col_source);
|
||||
segm_oY = GetBoard()->GetBoundingBox().GetY() + (Board.m_GridRouting * row_source);
|
||||
segm_fX = GetBoard()->GetBoundingBox().GetX() + (Board.m_GridRouting * col_target);
|
||||
segm_fY = GetBoard()->GetBoundingBox().GetY() + (Board.m_GridRouting * row_target);
|
||||
segm_oX = GetBoard()->GetBoundingBox().GetX() + (RoutingMatrix.m_GridRouting * col_source);
|
||||
segm_oY = GetBoard()->GetBoundingBox().GetY() + (RoutingMatrix.m_GridRouting * row_source);
|
||||
segm_fX = GetBoard()->GetBoundingBox().GetX() + (RoutingMatrix.m_GridRouting * col_target);
|
||||
segm_fY = GetBoard()->GetBoundingBox().GetY() + (RoutingMatrix.m_GridRouting * row_target);
|
||||
|
||||
/* Draw segment. */
|
||||
GRLine( m_canvas->GetClipBox(),
|
||||
DC,
|
||||
segm_oX,
|
||||
segm_oY,
|
||||
segm_fX,
|
||||
segm_fY,
|
||||
0,
|
||||
WHITE | GR_XOR );
|
||||
GRLine( m_canvas->GetClipBox(), DC,
|
||||
segm_oX, segm_oY, segm_fX, segm_fY,
|
||||
0, WHITE | GR_XOR );
|
||||
pt_cur_ch->m_PadStart->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT );
|
||||
pt_cur_ch->m_PadEnd->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT );
|
||||
|
||||
success = Autoroute_One_Track( this,
|
||||
DC,
|
||||
two_sides,
|
||||
row_source,
|
||||
col_source,
|
||||
row_target,
|
||||
col_target,
|
||||
pt_cur_ch );
|
||||
success = Autoroute_One_Track( this, DC,
|
||||
two_sides, row_source, col_source,
|
||||
row_target, col_target, pt_cur_ch );
|
||||
|
||||
switch( success )
|
||||
{
|
||||
|
@ -433,9 +427,9 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
marge = s_Clearance + ( pcbframe->GetBoard()->GetCurrentTrackWidth() / 2 );
|
||||
|
||||
/* clear direction flags */
|
||||
i = Nrows * Ncols * sizeof(DIR_CELL);
|
||||
memset( Board.m_DirSide[TOP], FROM_NOWHERE, i );
|
||||
memset( Board.m_DirSide[BOTTOM], FROM_NOWHERE, i );
|
||||
i = RoutingMatrix.m_Nrows * RoutingMatrix.m_Ncols * sizeof(DIR_CELL);
|
||||
memset( RoutingMatrix.m_DirSide[TOP], FROM_NOWHERE, i );
|
||||
memset( RoutingMatrix.m_DirSide[BOTTOM], FROM_NOWHERE, i );
|
||||
|
||||
lastopen = lastclos = lastmove = 0;
|
||||
|
||||
|
@ -467,9 +461,9 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
* On the routing grid (1 grid point must be in the pad)
|
||||
*/
|
||||
{
|
||||
int cX = ( Board.m_GridRouting * col_source )
|
||||
int cX = ( RoutingMatrix.m_GridRouting * col_source )
|
||||
+ pcbframe->GetBoard()->GetBoundingBox().GetX();
|
||||
int cY = ( Board.m_GridRouting * row_source )
|
||||
int cY = ( RoutingMatrix.m_GridRouting * row_source )
|
||||
+ pcbframe->GetBoard()->GetBoundingBox().GetY();
|
||||
int dx = pt_cur_ch->m_PadStart->GetSize().x / 2;
|
||||
int dy = pt_cur_ch->m_PadStart->GetSize().y / 2;
|
||||
|
@ -482,9 +476,9 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
if( ( abs( cX - px ) > dx ) || ( abs( cY - py ) > dy ) )
|
||||
goto end_of_route;
|
||||
|
||||
cX = ( Board.m_GridRouting * col_target )
|
||||
cX = ( RoutingMatrix.m_GridRouting * col_target )
|
||||
+ pcbframe->GetBoard()->GetBoundingBox().GetX();
|
||||
cY = ( Board.m_GridRouting * row_target )
|
||||
cY = ( RoutingMatrix.m_GridRouting * row_target )
|
||||
+ pcbframe->GetBoard()->GetBoundingBox().GetY();
|
||||
dx = pt_cur_ch->m_PadEnd->GetSize().x / 2;
|
||||
dy = pt_cur_ch->m_PadEnd->GetSize().y / 2;
|
||||
|
@ -510,8 +504,8 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
/* Placing the bit to remove obstacles on 2 pads to a link. */
|
||||
pcbframe->SetStatusText( wxT( "Gen Cells" ) );
|
||||
|
||||
PlacePad( pcbframe->GetBoard(), pt_cur_ch->m_PadStart, CURRENT_PAD, marge, WRITE_OR_CELL );
|
||||
PlacePad( pcbframe->GetBoard(), pt_cur_ch->m_PadEnd, CURRENT_PAD, marge, WRITE_OR_CELL );
|
||||
PlacePad( pt_cur_ch->m_PadStart, CURRENT_PAD, marge, WRITE_OR_CELL );
|
||||
PlacePad( pt_cur_ch->m_PadEnd, CURRENT_PAD, marge, WRITE_OR_CELL );
|
||||
|
||||
/* Regenerates the remaining barriers (which may encroach on the placement bits precedent)
|
||||
*/
|
||||
|
@ -523,7 +517,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
|
||||
if( ( pt_cur_ch->m_PadStart != ptr ) && ( pt_cur_ch->m_PadEnd != ptr ) )
|
||||
{
|
||||
PlacePad( pcbframe->GetBoard(), ptr, ~CURRENT_PAD, marge, WRITE_AND_CELL );
|
||||
PlacePad( ptr, ~CURRENT_PAD, marge, WRITE_AND_CELL );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -597,7 +591,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
|
||||
for( ; r != ILLEGAL; GetQueue( &r, &c, &side, &d, &apx_dist ) )
|
||||
{
|
||||
curcell = GetCell( r, c, side );
|
||||
curcell = RoutingMatrix.GetCell( r, c, side );
|
||||
|
||||
if( curcell & CURRENT_PAD )
|
||||
curcell &= ~HOLE;
|
||||
|
@ -669,13 +663,14 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
nc = c + delta[i][1];
|
||||
|
||||
/* off the edge? */
|
||||
if( nr < 0 || nr >= Nrows || nc < 0 || nc >= Ncols )
|
||||
if( nr < 0 || nr >= RoutingMatrix.m_Nrows ||
|
||||
nc < 0 || nc >= RoutingMatrix.m_Ncols )
|
||||
continue; /* off the edge */
|
||||
|
||||
if( _self == 5 && selfok2[i].present )
|
||||
continue;
|
||||
|
||||
newcell = GetCell( nr, nc, side );
|
||||
newcell = RoutingMatrix.GetCell( nr, nc, side );
|
||||
|
||||
if( newcell & CURRENT_PAD )
|
||||
newcell &= ~HOLE;
|
||||
|
@ -696,7 +691,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
if( delta[i][0] && delta[i][1] )
|
||||
{
|
||||
/* check first buddy */
|
||||
buddy = GetCell( r + blocking[i].r1, c + blocking[i].c1, side );
|
||||
buddy = RoutingMatrix.GetCell( r + blocking[i].r1, c + blocking[i].c1, side );
|
||||
|
||||
if( buddy & CURRENT_PAD )
|
||||
buddy &= ~HOLE;
|
||||
|
@ -706,7 +701,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
|
||||
// if (buddy & (blocking[i].b1)) continue;
|
||||
/* check second buddy */
|
||||
buddy = GetCell( r + blocking[i].r2, c + blocking[i].c2, side );
|
||||
buddy = RoutingMatrix.GetCell( r + blocking[i].r2, c + blocking[i].c2, side );
|
||||
|
||||
if( buddy & CURRENT_PAD )
|
||||
buddy &= ~HOLE;
|
||||
|
@ -717,17 +712,17 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
// if (buddy & (blocking[i].b2)) continue;
|
||||
}
|
||||
|
||||
olddir = GetDir( r, c, side );
|
||||
olddir = RoutingMatrix.GetDir( r, c, side );
|
||||
newdist = d + CalcDist( ndir[i], olddir,
|
||||
( olddir == FROM_OTHERSIDE ) ?
|
||||
GetDir( r, c, 1 - side ) : 0, side );
|
||||
RoutingMatrix.GetDir( r, c, 1 - side ) : 0, side );
|
||||
|
||||
/* if (a) not visited yet, or (b) we have */
|
||||
/* found a better path, add it to queue */
|
||||
if( !GetDir( nr, nc, side ) )
|
||||
if( !RoutingMatrix.GetDir( nr, nc, side ) )
|
||||
{
|
||||
SetDir( nr, nc, side, ndir[i] );
|
||||
SetDist( nr, nc, side, newdist );
|
||||
RoutingMatrix.SetDir( nr, nc, side, ndir[i] );
|
||||
RoutingMatrix.SetDist( nr, nc, side, newdist );
|
||||
|
||||
if( SetQueue( nr, nc, side, newdist,
|
||||
GetApxDist( nr, nc, row_target, col_target ),
|
||||
|
@ -736,10 +731,10 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
return ERR_MEMORY;
|
||||
}
|
||||
}
|
||||
else if( newdist < GetDist( nr, nc, side ) )
|
||||
else if( newdist < RoutingMatrix.GetDist( nr, nc, side ) )
|
||||
{
|
||||
SetDir( nr, nc, side, ndir[i] );
|
||||
SetDist( nr, nc, side, newdist );
|
||||
RoutingMatrix.SetDir( nr, nc, side, ndir[i] );
|
||||
RoutingMatrix.SetDist( nr, nc, side, newdist );
|
||||
ReSetQueue( nr, nc, side, newdist,
|
||||
GetApxDist( nr, nc, row_target, col_target ),
|
||||
row_target, col_target );
|
||||
|
@ -749,7 +744,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
/** Test the other layer. **/
|
||||
if( two_sides )
|
||||
{
|
||||
olddir = GetDir( r, c, side );
|
||||
olddir = RoutingMatrix.GetDir( r, c, side );
|
||||
|
||||
if( olddir == FROM_OTHERSIDE )
|
||||
continue; /* useless move, so don't bother */
|
||||
|
@ -758,7 +753,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
continue;
|
||||
|
||||
/* check for holes or traces on other side */
|
||||
if( ( newcell = GetCell( r, c, 1 - side ) ) != 0 )
|
||||
if( ( newcell = RoutingMatrix.GetCell( r, c, 1 - side ) ) != 0 )
|
||||
continue;
|
||||
|
||||
/* check for nearby holes or traces on both sides */
|
||||
|
@ -766,16 +761,17 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
{
|
||||
nr = r + delta[i][0]; nc = c + delta[i][1];
|
||||
|
||||
if( nr < 0 || nr >= Nrows || nc < 0 || nc >= Ncols )
|
||||
if( nr < 0 || nr >= RoutingMatrix.m_Nrows ||
|
||||
nc < 0 || nc >= RoutingMatrix.m_Ncols )
|
||||
continue; /* off the edge !! */
|
||||
|
||||
if( GetCell( nr, nc, side ) /* & blocking2[i]*/ )
|
||||
if( RoutingMatrix.GetCell( nr, nc, side ) /* & blocking2[i]*/ )
|
||||
{
|
||||
skip = 1; /* can't drill via here */
|
||||
break;
|
||||
}
|
||||
|
||||
if( GetCell( nr, nc, 1 - side ) /* & blocking2[i]*/ )
|
||||
if( RoutingMatrix.GetCell( nr, nc, 1 - side ) /* & blocking2[i]*/ )
|
||||
{
|
||||
skip = 1; /* can't drill via here */
|
||||
break;
|
||||
|
@ -790,22 +786,21 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
/* if (a) not visited yet,
|
||||
* or (b) we have found a better path,
|
||||
* add it to queue */
|
||||
if( !GetDir( r, c, 1 - side ) )
|
||||
if( !RoutingMatrix.GetDir( r, c, 1 - side ) )
|
||||
{
|
||||
SetDir( r, c, 1 - side, FROM_OTHERSIDE );
|
||||
SetDist( r, c, 1 - side, newdist );
|
||||
RoutingMatrix.SetDir( r, c, 1 - side, FROM_OTHERSIDE );
|
||||
RoutingMatrix.SetDist( r, c, 1 - side, newdist );
|
||||
|
||||
if( SetQueue( r, c, 1 - side, newdist, apx_dist, row_target, col_target ) == 0 )
|
||||
{
|
||||
return ERR_MEMORY;
|
||||
}
|
||||
}
|
||||
else if( newdist < GetDist( r, c, 1 - side ) )
|
||||
else if( newdist < RoutingMatrix.GetDist( r, c, 1 - side ) )
|
||||
{
|
||||
SetDir( r, c, 1 - side, FROM_OTHERSIDE );
|
||||
SetDist( r, c, 1 - side, newdist );
|
||||
ReSetQueue( r,
|
||||
c,
|
||||
RoutingMatrix.SetDir( r, c, 1 - side, FROM_OTHERSIDE );
|
||||
RoutingMatrix.SetDist( r, c, 1 - side, newdist );
|
||||
ReSetQueue( r, c,
|
||||
1 - side,
|
||||
newdist,
|
||||
apx_dist,
|
||||
|
@ -816,8 +811,8 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
}
|
||||
|
||||
end_of_route:
|
||||
PlacePad( pcbframe->GetBoard(), pt_cur_ch->m_PadStart, ~CURRENT_PAD, marge, WRITE_AND_CELL );
|
||||
PlacePad( pcbframe->GetBoard(), pt_cur_ch->m_PadEnd, ~CURRENT_PAD, marge, WRITE_AND_CELL );
|
||||
PlacePad( pt_cur_ch->m_PadStart, ~CURRENT_PAD, marge, WRITE_AND_CELL );
|
||||
PlacePad( pt_cur_ch->m_PadEnd, ~CURRENT_PAD, marge, WRITE_AND_CELL );
|
||||
|
||||
msg.Printf( wxT( "Activity: Open %d Closed %d Moved %d"),
|
||||
OpenNodes, ClosNodes, MoveNodes );
|
||||
|
@ -966,7 +961,7 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
|
|||
{
|
||||
/* find where we came from to get here */
|
||||
r2 = r1; c2 = c1; s2 = s1;
|
||||
x = GetDir( r1, c1, s1 );
|
||||
x = RoutingMatrix.GetDir( r1, c1, s1 );
|
||||
|
||||
switch( x )
|
||||
{
|
||||
|
@ -1011,12 +1006,12 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
|
|||
break;
|
||||
|
||||
default:
|
||||
DisplayError( pcbframe, wxT( "Retrace: internal error: no way back" ) );
|
||||
wxMessageBox( wxT( "Retrace: internal error: no way back" ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( r0 != ILLEGAL )
|
||||
y = GetDir( r0, c0, s0 );
|
||||
y = RoutingMatrix.GetDir( r0, c0, s0 );
|
||||
|
||||
/* see if target or hole */
|
||||
if( ( ( r1 == row_target ) && ( c1 == col_target ) ) || ( s1 != s0 ) )
|
||||
|
@ -1085,7 +1080,7 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
|
|||
}
|
||||
else
|
||||
{
|
||||
DisplayError( pcbframe, wxT( "Retrace: error 2" ) );
|
||||
wxMessageBox( wxT( "Retrace: error 2" ) );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -1130,7 +1125,7 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
|
|||
|
||||
case FROM_OTHERSIDE:
|
||||
default:
|
||||
DisplayError( pcbframe, wxT( "Retrace: error 3" ) );
|
||||
wxMessageBox( wxT( "Retrace: error 3" ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1171,11 +1166,11 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
|
|||
|
||||
g_CurrentTrackSegment->m_Start.x =
|
||||
g_CurrentTrackSegment->m_End.x = pcb->GetBoundingBox().GetX() +
|
||||
( Board.m_GridRouting * row );
|
||||
( RoutingMatrix.m_GridRouting * row );
|
||||
|
||||
g_CurrentTrackSegment->m_Start.y =
|
||||
g_CurrentTrackSegment->m_End.y = pcb->GetBoundingBox().GetY() +
|
||||
( Board.m_GridRouting * col );
|
||||
( RoutingMatrix.m_GridRouting * col );
|
||||
|
||||
g_CurrentTrackSegment->m_Width = pcb->GetCurrentViaSize();
|
||||
g_CurrentTrackSegment->m_Shape = pcb->GetDesignSettings().m_CurrentViaType;
|
||||
|
@ -1195,9 +1190,9 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
|
|||
|
||||
g_CurrentTrackSegment->SetState( TRACK_AR, ON );
|
||||
g_CurrentTrackSegment->m_End.x = pcb->GetBoundingBox().GetX() +
|
||||
( Board.m_GridRouting * row );
|
||||
( RoutingMatrix.m_GridRouting * row );
|
||||
g_CurrentTrackSegment->m_End.y = pcb->GetBoundingBox().GetY() +
|
||||
( Board.m_GridRouting * col );
|
||||
( RoutingMatrix.m_GridRouting * col );
|
||||
g_CurrentTrackSegment->SetNet( current_net_code );
|
||||
|
||||
if( g_CurrentTrackSegment->Back() == NULL ) /* Start trace. */
|
||||
|
@ -1315,9 +1310,8 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
|
|||
/* Out the new track on the matrix board */
|
||||
for( TRACK* track = g_FirstTrackSegment; track; track = track->Next() )
|
||||
{
|
||||
TraceSegmentPcb( pcbframe->GetBoard(), track, HOLE, marge, WRITE_CELL );
|
||||
TraceSegmentPcb( pcbframe->GetBoard(), track, VIA_IMPOSSIBLE,
|
||||
via_marge, WRITE_OR_CELL );
|
||||
TraceSegmentPcb( track, HOLE, marge, WRITE_CELL );
|
||||
TraceSegmentPcb( track, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||
}
|
||||
|
||||
// Insert new segments in real board
|
|
@ -0,0 +1,238 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
*
|
||||
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* First copyright (C) Randy Nevin, 1989 (see PCBCA package)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @file work.cpp
|
||||
* @brief Automatic routing routines
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
|
||||
#include <pcbnew.h>
|
||||
#include <autorout.h>
|
||||
#include <cell.h>
|
||||
|
||||
|
||||
struct CWORK // a unit of work is a source-target (a ratsnet item) to connect
|
||||
{
|
||||
struct CWORK* m_Next;
|
||||
int m_FromRow; // source row
|
||||
int m_FromCol; // source column
|
||||
int m_ToRow; // target row
|
||||
int m_ToCol; // target column
|
||||
RATSNEST_ITEM* m_Ratsnest; // Corresponding ratsnest
|
||||
int m_NetCode; // m_NetCode
|
||||
int m_ApxDist; // approximate distance
|
||||
int m_Cost; // cost for sort by length
|
||||
int m_Priority; // route priority
|
||||
};
|
||||
|
||||
|
||||
// pointers to the first and last item of work to do
|
||||
static CWORK* Head = NULL;
|
||||
static CWORK* Tail = NULL;
|
||||
static CWORK* Current = NULL;
|
||||
|
||||
|
||||
// initialize the work list
|
||||
void InitWork()
|
||||
{
|
||||
CWORK* ptr;
|
||||
|
||||
while( ( ptr = Head ) != NULL )
|
||||
{
|
||||
Head = ptr->m_Next;
|
||||
delete ptr;
|
||||
}
|
||||
|
||||
Tail = Current = NULL;
|
||||
}
|
||||
|
||||
|
||||
// initialize the work list
|
||||
void ReInitWork()
|
||||
{
|
||||
Current = Head;
|
||||
}
|
||||
|
||||
|
||||
/* add a unit of work to the work list
|
||||
* Return:
|
||||
* 1 if OK
|
||||
* 0 if memory allocation failed
|
||||
*/
|
||||
static int GetCost( int r1, int c1, int r2, int c2 );
|
||||
|
||||
int SetWork( int r1, int c1,
|
||||
int n_c,
|
||||
int r2, int c2,
|
||||
RATSNEST_ITEM* pt_ch, int pri )
|
||||
{
|
||||
CWORK* p;
|
||||
|
||||
if( ( p = (CWORK*) operator new( sizeof(CWORK), std::nothrow ) ) != NULL )
|
||||
{
|
||||
p->m_FromRow = r1;
|
||||
p->m_FromCol = c1;
|
||||
p->m_NetCode = n_c;
|
||||
p->m_ToRow = r2;
|
||||
p->m_ToCol = c2;
|
||||
p->m_Ratsnest = pt_ch;
|
||||
p->m_ApxDist = GetApxDist( r1, c1, r2, c2 );
|
||||
p->m_Cost = GetCost( r1, c1, r2, c2 );
|
||||
p->m_Priority = pri;
|
||||
p->m_Next = NULL;
|
||||
|
||||
if( Head ) /* attach at end */
|
||||
Tail->m_Next = p;
|
||||
else /* first in list */
|
||||
Head = Current = p;
|
||||
|
||||
Tail = p;
|
||||
return 1;
|
||||
}
|
||||
else /* can't get any more memory */
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* fetch a unit of work from the work list */
|
||||
void GetWork( int* r1, int* c1,
|
||||
int* n_c,
|
||||
int* r2, int* c2,
|
||||
RATSNEST_ITEM** pt_ch )
|
||||
{
|
||||
if( Current )
|
||||
{
|
||||
*r1 = Current->m_FromRow;
|
||||
*c1 = Current->m_FromCol;
|
||||
*n_c = Current->m_NetCode;
|
||||
*r2 = Current->m_ToRow;
|
||||
*c2 = Current->m_ToCol;
|
||||
*pt_ch = Current->m_Ratsnest;
|
||||
Current = Current->m_Next;
|
||||
}
|
||||
else /* none left */
|
||||
{
|
||||
*r1 = *c1 = *r2 = *c2 = ILLEGAL;
|
||||
*n_c = 0;
|
||||
*pt_ch = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* order the work items; shortest (low cost) first */
|
||||
void SortWork()
|
||||
{
|
||||
CWORK* p;
|
||||
CWORK* q0; /* put PRIORITY PAD_CONNECTs in q0 */
|
||||
CWORK* q1; /* sort other PAD_CONNECTs in q1 */
|
||||
CWORK* r;
|
||||
|
||||
q0 = q1 = NULL;
|
||||
|
||||
while( (p = Head) != NULL ) /* prioritize each work item */
|
||||
{
|
||||
Head = Head->m_Next;
|
||||
|
||||
if( p->m_Priority ) /* put at end of priority list */
|
||||
{
|
||||
p->m_Next = NULL;
|
||||
|
||||
if( (r = q0) == NULL ) /* empty list? */
|
||||
{
|
||||
q0 = p;
|
||||
}
|
||||
else /* attach at end */
|
||||
{
|
||||
while( r->m_Next ) /* search for end */
|
||||
r = r->m_Next;
|
||||
|
||||
r->m_Next = p; /* attach */
|
||||
}
|
||||
}
|
||||
else if( ( ( r = q1 ) == NULL ) || ( p->m_Cost < q1->m_Cost ) )
|
||||
{
|
||||
p->m_Next = q1;
|
||||
q1 = p;
|
||||
}
|
||||
else /* find proper position in list */
|
||||
{
|
||||
while( r->m_Next && p->m_Cost >= r->m_Next->m_Cost )
|
||||
r = r->m_Next;
|
||||
|
||||
p->m_Next = r->m_Next;
|
||||
r->m_Next = p;
|
||||
}
|
||||
}
|
||||
|
||||
if( (p = q0) != NULL ) /* any priority PAD_CONNECTs? */
|
||||
{
|
||||
while( q0->m_Next )
|
||||
q0 = q0->m_Next;
|
||||
|
||||
q0->m_Next = q1;
|
||||
}
|
||||
else
|
||||
p = q1;
|
||||
|
||||
/* reposition Head and Tail */
|
||||
for( Head = Current = Tail = p; Tail && Tail->m_Next; Tail = Tail->m_Next )
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
/* Calculate the cost of a ratsnest:
|
||||
* cost = (| dx | + | dy |) * disability
|
||||
* disability = 1 if dx or dy = 0, max if | dx | # | dy |
|
||||
*/
|
||||
static int GetCost( int r1, int c1, int r2, int c2 )
|
||||
{
|
||||
int dx, dy, mx, my;
|
||||
double incl = 1.0;
|
||||
|
||||
dx = abs( c2 - c1 );
|
||||
dy = abs( r2 - r1 );
|
||||
mx = dx;
|
||||
my = dy;
|
||||
|
||||
if( mx < my )
|
||||
{
|
||||
mx = dy; my = dx;
|
||||
}
|
||||
|
||||
if( mx )
|
||||
incl += (2 * (double) my / mx);
|
||||
|
||||
return (int) ( ( dx + dy ) * incl );
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
|
|
@ -2,6 +2,31 @@
|
|||
/* board editor: undo and redo functions for board editor */
|
||||
/*************************************************************/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2012 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
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <macros.h>
|
||||
|
|
|
@ -3,6 +3,33 @@
|
|||
* @brief BOARD class functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
*
|
||||
* Copyright (C) 1992-2012 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
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -47,10 +74,14 @@ BOARD::BOARD() :
|
|||
|
||||
BuildListOfNets(); // prepare pad and netlist containers.
|
||||
|
||||
for( int layer = 0; layer < NB_COPPER_LAYERS; ++layer )
|
||||
for( int layer = 0; layer < LAYER_COUNT; ++layer )
|
||||
{
|
||||
m_Layer[layer].m_Name = GetDefaultLayerName( layer );
|
||||
m_Layer[layer].m_Type = LT_SIGNAL;
|
||||
|
||||
if( layer <= LAST_COPPER_LAYER )
|
||||
m_Layer[layer].m_Type = LT_SIGNAL;
|
||||
else
|
||||
m_Layer[layer].m_Type = LT_UNDEFINED;
|
||||
}
|
||||
|
||||
m_NetClasses.GetDefault()->SetDescription( _( "This is the default net class." ) );
|
||||
|
@ -312,13 +343,25 @@ int BOARD::GetCurrentMicroViaDrill()
|
|||
}
|
||||
|
||||
|
||||
bool BOARD::SetLayer( int aIndex, const LAYER& aLayer )
|
||||
{
|
||||
if( aIndex < NB_COPPER_LAYERS )
|
||||
{
|
||||
m_Layer[ aIndex ] = aLayer;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
wxString BOARD::GetLayerName( int aLayerIndex ) const
|
||||
{
|
||||
if( !IsValidLayerIndex( aLayerIndex ) )
|
||||
return wxEmptyString;
|
||||
|
||||
// copper layer names are stored in the BOARD.
|
||||
if( IsValidCopperLayerIndex( aLayerIndex ) && IsLayerEnabled( aLayerIndex ) )
|
||||
// All layer names are stored in the BOARD.
|
||||
if( IsLayerEnabled( aLayerIndex ) )
|
||||
{
|
||||
// default names were set in BOARD::BOARD() but they may be
|
||||
// over-ridden by BOARD::SetLayerName()
|
||||
|
@ -380,7 +423,7 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName )
|
|||
if( !IsValidCopperLayerIndex( aLayerIndex ) )
|
||||
return false;
|
||||
|
||||
if( aLayerName == wxEmptyString || aLayerName.Len() > 20 )
|
||||
if( aLayerName == wxEmptyString || aLayerName.Len() > 20 )
|
||||
return false;
|
||||
|
||||
// no quote chars in the name allowed
|
||||
|
@ -479,14 +522,65 @@ LAYER_T LAYER::ParseType( const char* aType )
|
|||
else if( strcmp( aType, "jumper" ) == 0 )
|
||||
return LT_JUMPER;
|
||||
else
|
||||
return LAYER_T( -1 );
|
||||
return LT_UNDEFINED;
|
||||
}
|
||||
|
||||
|
||||
int LAYER::GetDefaultIndex( const wxString& aName )
|
||||
{
|
||||
static LAYER_INDEX_HASH_MAP layerIndices;
|
||||
|
||||
if( layerIndices.empty() )
|
||||
{
|
||||
// These are only default layer names. The copper names may be over-ridden in
|
||||
// the BOARD (*.brd) file.
|
||||
|
||||
layerIndices[ _( "Front" ) ] = LAYER_N_FRONT;
|
||||
layerIndices[ _( "Inner2" ) ] = LAYER_N_2;
|
||||
layerIndices[ _( "Inner3" ) ] = LAYER_N_3;
|
||||
layerIndices[ _( "Inner4" ) ] = LAYER_N_4;
|
||||
layerIndices[ _( "Inner5" ) ] = LAYER_N_5;
|
||||
layerIndices[ _( "Inner6" ) ] = LAYER_N_6;
|
||||
layerIndices[ _( "Inner7" ) ] = LAYER_N_7;
|
||||
layerIndices[ _( "Inner8" ) ] = LAYER_N_8;
|
||||
layerIndices[ _( "Inner9" ) ] = LAYER_N_9;
|
||||
layerIndices[ _( "Inner10" ) ] = LAYER_N_10;
|
||||
layerIndices[ _( "Inner11" ) ] = LAYER_N_11;
|
||||
layerIndices[ _( "Inner12" ) ] = LAYER_N_12;
|
||||
layerIndices[ _( "Inner13" ) ] = LAYER_N_13;
|
||||
layerIndices[ _( "Inner14" ) ] = LAYER_N_14;
|
||||
layerIndices[ _( "Inner15" ) ] = LAYER_N_15;
|
||||
layerIndices[ _( "Back" ) ] = LAYER_N_BACK;
|
||||
layerIndices[ _( "Adhes_Back" ) ] = ADHESIVE_N_BACK;
|
||||
layerIndices[ _( "Adhes_Front" ) ] = ADHESIVE_N_FRONT;
|
||||
layerIndices[ _( "SoldP_Back" ) ] = SOLDERPASTE_N_BACK;
|
||||
layerIndices[ _( "SoldP_Front" ) ] = SOLDERPASTE_N_FRONT;
|
||||
layerIndices[ _( "SilkS_Back" ) ] = SILKSCREEN_N_BACK;
|
||||
layerIndices[ _( "SilkS_Front" ) ] = SILKSCREEN_N_FRONT;
|
||||
layerIndices[ _( "Mask_Back" ) ] = SOLDERMASK_N_BACK;
|
||||
layerIndices[ _( "Mask_Front" ) ] = SOLDERMASK_N_FRONT;
|
||||
layerIndices[ _( "Drawings" ) ] = DRAW_N;
|
||||
layerIndices[ _( "Comments" ) ] = COMMENT_N;
|
||||
layerIndices[ _( "Eco1" ) ] = ECO1_N;
|
||||
layerIndices[ _( "Eco2" ) ] = ECO2_N;
|
||||
layerIndices[ _( "PCB_Edges" ) ] = EDGE_N;
|
||||
}
|
||||
|
||||
const LAYER_INDEX_HASH_MAP::iterator it = layerIndices.find( aName );
|
||||
|
||||
if( it == layerIndices.end() )
|
||||
return UNDEFINED_LAYER;
|
||||
|
||||
return layerIndices[ aName ];
|
||||
}
|
||||
|
||||
|
||||
int BOARD::GetCopperLayerCount() const
|
||||
{
|
||||
return m_designSettings.GetCopperLayerCount();
|
||||
}
|
||||
|
||||
|
||||
void BOARD::SetCopperLayerCount( int aCount )
|
||||
{
|
||||
m_designSettings.SetCopperLayerCount( aCount );
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
#include <class_zone_settings.h>
|
||||
#include <pcb_plot_params.h>
|
||||
|
||||
#include <wx/hashmap.h>
|
||||
|
||||
|
||||
class PCB_BASE_FRAME;
|
||||
class PCB_EDIT_FRAME;
|
||||
class PICKED_ITEMS_LIST;
|
||||
|
@ -43,6 +46,7 @@ typedef std::vector< TRACK* > TRACK_PTRS;
|
|||
*/
|
||||
enum LAYER_T
|
||||
{
|
||||
LT_UNDEFINED = -1,
|
||||
LT_SIGNAL,
|
||||
LT_POWER,
|
||||
LT_MIXED,
|
||||
|
@ -51,11 +55,27 @@ enum LAYER_T
|
|||
|
||||
|
||||
/**
|
||||
* Struct LAYER
|
||||
* Class LAYER
|
||||
* holds information pertinent to a layer of a BOARD.
|
||||
*/
|
||||
struct LAYER
|
||||
class LAYER
|
||||
{
|
||||
public:
|
||||
LAYER( const wxString& aName = wxEmptyString, LAYER_T aType = LT_SIGNAL,
|
||||
bool aVisible = true ) :
|
||||
m_Name( aName ),
|
||||
m_Type( aType ),
|
||||
m_visible( aVisible ),
|
||||
m_fixedListIndex( UNDEFINED_LAYER )
|
||||
{
|
||||
}
|
||||
|
||||
void SetVisible( bool aEnable ) { m_visible = aEnable; }
|
||||
bool IsVisible() const { return m_visible; }
|
||||
|
||||
void SetFixedListIndex( int aIndex ) { m_fixedListIndex = aIndex; }
|
||||
int GetFixedListIndex() const { return m_fixedListIndex; }
|
||||
|
||||
/** The name of the layer, there should be no spaces in this name. */
|
||||
wxString m_Name;
|
||||
|
||||
|
@ -63,7 +83,6 @@ struct LAYER
|
|||
LAYER_T m_Type;
|
||||
|
||||
// int m_Color;
|
||||
// bool m_Visible; // ? use flags in m_Color instead ?
|
||||
|
||||
/**
|
||||
* Function ShowType
|
||||
|
@ -81,9 +100,25 @@ struct LAYER
|
|||
* LAYER_T(-1) if the string is invalid
|
||||
*/
|
||||
static LAYER_T ParseType( const char* aType );
|
||||
|
||||
/**
|
||||
* Function GetDefaultIndex
|
||||
* returns the layer index of the layer \a aName.
|
||||
*
|
||||
* @param aName A reference to a wxString object containing the default layer name.
|
||||
* @return The index of the layer \a aName if found otherwise #UNDEFINED_LAYER_INDEX.
|
||||
*/
|
||||
static int GetDefaultIndex( const wxString& aName );
|
||||
|
||||
private:
|
||||
bool m_visible;
|
||||
int m_fixedListIndex;
|
||||
};
|
||||
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP( int, LAYER_INDEX_HASH_MAP );
|
||||
|
||||
|
||||
/**
|
||||
* Struct VIA_DIMENSION
|
||||
* is a small helper container to handle a stock of specific vias each with
|
||||
|
@ -164,7 +199,7 @@ private:
|
|||
/// edge zone descriptors, owned by pointer.
|
||||
ZONE_CONTAINERS m_ZoneDescriptorList;
|
||||
|
||||
LAYER m_Layer[NB_COPPER_LAYERS];
|
||||
LAYER m_Layer[LAYER_COUNT];
|
||||
// if true m_highLight_NetCode is used
|
||||
HIGH_LIGHT_INFO m_highLight; // current high light data
|
||||
HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
|
||||
|
@ -600,6 +635,8 @@ public:
|
|||
*/
|
||||
bool SetLayerName( int aLayerIndex, const wxString& aLayerName );
|
||||
|
||||
bool SetLayer( int aIndex, const LAYER& aLayer );
|
||||
|
||||
/**
|
||||
* Function GetLayerType
|
||||
* returns the type of the copper layer given by aLayerIndex.
|
||||
|
|
|
@ -3,6 +3,31 @@
|
|||
* @brief BOARD_CONNECTED_ITEM class functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2012 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
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <pcbnew.h>
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
|
|||
m_ModuleSegmentWidth = DMils2iu( 100 );
|
||||
|
||||
// Layer thickness for 3D viewer
|
||||
m_BoardThickness = DMils2iu( DEFAULT_BOARD_THICKNESS_DMILS );
|
||||
m_boardThickness = DMils2iu( DEFAULT_BOARD_THICKNESS_DMILS );
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,7 +70,7 @@ void BOARD_DESIGN_SETTINGS::AppendConfigs( PARAM_CFG_ARRAY* aResult )
|
|||
{
|
||||
m_Pad_Master.AppendConfigs( aResult );
|
||||
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "BoardThickness" ), &m_BoardThickness,
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "BoardThickness" ), &m_boardThickness,
|
||||
DMils2iu( DEFAULT_BOARD_THICKNESS_DMILS ), 0, 0xFFFF ) );
|
||||
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtPcbV" ), &m_PcbTextSize.y,
|
||||
|
|
|
@ -3,6 +3,31 @@
|
|||
* @brief Class BOARD_ITEM definition and some basic functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2012 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
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
#include <pcbnew.h>
|
||||
|
@ -66,20 +91,15 @@ wxString BOARD_ITEM::GetLayerName() const
|
|||
|
||||
std::string BOARD_ITEM::FormatInternalUnits( int aValue )
|
||||
{
|
||||
char buf[50];
|
||||
char buf[50];
|
||||
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
double engUnits = aValue / 1000000.0;
|
||||
#else
|
||||
double engUnits = ( aValue * 10000.0 ) / 25.4 / 1000000.0;
|
||||
#endif
|
||||
double mm = aValue / IU_PER_MM;
|
||||
|
||||
int len;
|
||||
|
||||
if( engUnits != 0.0 && fabs( engUnits ) <= 0.0001 )
|
||||
if( mm != 0.0 && fabs( mm ) <= 0.0001 )
|
||||
{
|
||||
// printf( "f: " );
|
||||
len = snprintf( buf, 49, "%.10f", engUnits );
|
||||
len = sprintf( buf, "%.10f", mm );
|
||||
|
||||
while( --len > 0 && buf[len] == '0' )
|
||||
buf[len] = '\0';
|
||||
|
@ -88,8 +108,7 @@ std::string BOARD_ITEM::FormatInternalUnits( int aValue )
|
|||
}
|
||||
else
|
||||
{
|
||||
// printf( "g: " );
|
||||
len = snprintf( buf, 49, "%.10g", engUnits );
|
||||
len = sprintf( buf, "%.10g", mm );
|
||||
}
|
||||
|
||||
return std::string( buf, len );
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
@ -239,14 +240,14 @@ void DIMENSION::Mirror( const wxPoint& axis_pos )
|
|||
|
||||
void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
|
||||
{
|
||||
#define ARROW_SIZE 500 //size of arrows
|
||||
int ii;
|
||||
int mesure, deltax, deltay; // value of the measure on X and Y axes
|
||||
int arrow_up_X = 0, arrow_up_Y = 0; // coordinates of arrow line /
|
||||
int arrow_dw_X = 0, arrow_dw_Y = 0; // coordinates of arrow line '\'
|
||||
int hx, hy; // dimension line interval
|
||||
double angle, angle_f;
|
||||
wxString msg;
|
||||
const int arrowz = DMils2iu( 500 ); // size of arrows
|
||||
int ii;
|
||||
int measure, deltax, deltay; // value of the measure on X and Y axes
|
||||
int arrow_up_X = 0, arrow_up_Y = 0; // coordinates of arrow line /
|
||||
int arrow_dw_X = 0, arrow_dw_Y = 0; // coordinates of arrow line '\'
|
||||
int hx, hy; // dimension line interval
|
||||
double angle, angle_f;
|
||||
wxString msg;
|
||||
|
||||
// Init layer :
|
||||
m_Text.SetLayer( GetLayer() );
|
||||
|
@ -259,7 +260,7 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
|
|||
deltay = m_featureLineDOy - m_featureLineGOy;
|
||||
|
||||
// Calculate dimension value
|
||||
mesure = KiROUND( hypot( (double) deltax, (double) deltay ) );
|
||||
measure = KiROUND( hypot( (double) deltax, (double) deltay ) );
|
||||
|
||||
if( deltax || deltay )
|
||||
angle = atan2( (double) deltay, (double) deltax );
|
||||
|
@ -270,10 +271,10 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
|
|||
hx = hy = ii;
|
||||
|
||||
// Taking into account the slope of the side lines.
|
||||
if( mesure )
|
||||
if( measure )
|
||||
{
|
||||
hx = (abs) ( (int) ( ( (double) deltay * hx ) / mesure ) );
|
||||
hy = (abs) ( (int) ( ( (double) deltax * hy ) / mesure ) );
|
||||
hx = (abs) ( (int) ( ( (double) deltay * hx ) / measure ) );
|
||||
hy = (abs) ( (int) ( ( (double) deltax * hy ) / measure ) );
|
||||
|
||||
if( m_featureLineGOx > m_crossBarOx )
|
||||
hx = -hx;
|
||||
|
@ -288,14 +289,13 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
|
|||
hy = 0;
|
||||
|
||||
angle_f = angle + (M_PI * 27.5 / 180);
|
||||
arrow_up_X = (int) ( ARROW_SIZE * cos( angle_f ) );
|
||||
arrow_up_Y = (int) ( ARROW_SIZE * sin( angle_f ) );
|
||||
arrow_up_X = (int) ( arrowz * cos( angle_f ) );
|
||||
arrow_up_Y = (int) ( arrowz * sin( angle_f ) );
|
||||
angle_f = angle - (M_PI * 27.5 / 180);
|
||||
arrow_dw_X = (int) ( ARROW_SIZE * cos( angle_f ) );
|
||||
arrow_dw_Y = (int) ( ARROW_SIZE * sin( angle_f ) );
|
||||
arrow_dw_X = (int) ( arrowz * cos( angle_f ) );
|
||||
arrow_dw_Y = (int) ( arrowz * sin( angle_f ) );
|
||||
}
|
||||
|
||||
|
||||
m_arrowG1Ox = m_crossBarOx;
|
||||
m_arrowG1Oy = m_crossBarOy;
|
||||
m_arrowG1Fx = m_crossBarOx + arrow_up_X;
|
||||
|
@ -344,7 +344,7 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
|
|||
|
||||
if( !aDoNotChangeText )
|
||||
{
|
||||
m_Value = mesure;
|
||||
m_Value = measure;
|
||||
msg = ::CoordinateToString( m_Value );
|
||||
SetText( msg );
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
|
||||
#include <class_board_item.h>
|
||||
#include <class_pcb_text.h>
|
||||
|
||||
|
||||
class LINE_READER;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
|
|
@ -1,8 +1,32 @@
|
|||
/*****************************************************************************/
|
||||
/* Functions to handle markers used to show something (usually a drc problem) */
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @file class_marker_pcb.cpp
|
||||
* @brief Functions to handle markers used to show something (usually a drc problem)
|
||||
*/
|
||||
|
||||
/* file class_marker.cpp */
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2012 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
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <gr_basic.h>
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
@ -571,6 +572,20 @@ D_PAD* MODULE::GetPad( const wxPoint& aPosition, int aLayerMask )
|
|||
}
|
||||
|
||||
|
||||
void MODULE::Add3DModel( S3D_MASTER* a3DModel )
|
||||
{
|
||||
a3DModel->SetParent( this );
|
||||
m_3D_Drawings.PushBack( a3DModel );
|
||||
}
|
||||
|
||||
|
||||
void MODULE::AddPad( D_PAD* aPad )
|
||||
{
|
||||
aPad->SetParent( this );
|
||||
m_Pads.PushBack( aPad );
|
||||
}
|
||||
|
||||
|
||||
// see class_module.h
|
||||
SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
|
||||
const KICAD_T scanTypes[] )
|
||||
|
|
|
@ -323,6 +323,22 @@ public:
|
|||
*/
|
||||
unsigned GetPadCount() const { return m_Pads.GetCount() ; }
|
||||
|
||||
/**
|
||||
* Function Add3DModel
|
||||
* adds \a a3DModel definition to the end of the 3D model list.
|
||||
*
|
||||
* @param a3DModel A pointer to a #S3D_MASTER to add to the list.
|
||||
*/
|
||||
void Add3DModel( S3D_MASTER* a3DModel );
|
||||
|
||||
/**
|
||||
* Function AddPad
|
||||
* adds \a aPad to the end of the pad list.
|
||||
*
|
||||
* @param aPad A pointer to a #D_PAD to add to the list.
|
||||
*/
|
||||
void AddPad( D_PAD* aPad );
|
||||
|
||||
SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
|
||||
const KICAD_T scanTypes[] );
|
||||
|
||||
|
|
|
@ -1,6 +1,31 @@
|
|||
/*************************************************************************/
|
||||
/* NETINFO_ITEM class, to handle info on nets (netnames, net constraints */
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* @brief NETINFO_ITEM class, to handle info on nets: netnames, net constraints
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2012 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
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <gr_basic.h>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
@ -185,6 +186,7 @@ wxString SEGZONE::GetSelectMenuText() const
|
|||
SEGVIA::SEGVIA( BOARD_ITEM* aParent ) :
|
||||
TRACK( aParent, PCB_VIA_T )
|
||||
{
|
||||
SetShape( VIA_THROUGH );
|
||||
}
|
||||
|
||||
|
||||
|
@ -873,8 +875,10 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
|
|||
}
|
||||
}
|
||||
|
||||
if( DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_ALWAYS )
|
||||
if( ShowClearance( this ) )
|
||||
{
|
||||
GRCircle( panel->GetClipBox(), DC, m_Start + aOffset, radius + GetClearance(), 0, color );
|
||||
}
|
||||
|
||||
// for Micro Vias, draw a partial cross : X on component layer, or + on copper layer
|
||||
// (so we can see 2 superimposed microvias ):
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
@ -484,28 +485,17 @@ bool ZONE_CONTAINER::HitTest( const wxPoint& aPosition )
|
|||
return false;
|
||||
}
|
||||
|
||||
// Zones outlines have no thickness, so it Hit Test functions
|
||||
// we must have a default distance between the test point
|
||||
// and a corner or a zone edge:
|
||||
#define MIN_DIST_IN_MILS 10
|
||||
|
||||
bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
|
||||
{
|
||||
m_CornerSelection = -1; // Set to not found
|
||||
|
||||
// distance (in internal units) to detect a corner in a zone outline.
|
||||
// @todo use a scaling factor here of actual screen coordinates, so that
|
||||
// when nanometers come, it still works.
|
||||
#define CORNER_MIN_DIST 100
|
||||
|
||||
int min_dist = CORNER_MIN_DIST + 1;
|
||||
|
||||
#if 0
|
||||
// Dick: I don't see this as reasonable. The mouse distance from the zone is
|
||||
// not a function of the grid, it is a fixed number of pixels, regardless of zoom.
|
||||
if( GetBoard() && GetBoard()->m_PcbFrame )
|
||||
{
|
||||
// Use grid size because it is known
|
||||
wxRealPoint grid = GetBoard()->m_PcbFrame->GetCanvas()->GetGrid();
|
||||
min_dist = KiROUND( MIN( grid.x, grid.y ) );
|
||||
}
|
||||
#endif
|
||||
int min_dist = MIN_DIST_IN_MILS*IU_PER_MILS;
|
||||
|
||||
wxPoint delta;
|
||||
unsigned lim = m_Poly->corner.size();
|
||||
|
@ -535,23 +525,8 @@ bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
|
|||
|
||||
m_CornerSelection = -1; // Set to not found
|
||||
|
||||
// @todo use a scaling factor here of actual screen coordinates, so that
|
||||
// when nanometers come, it still works. This should be done in screen coordinates
|
||||
// not internal units.
|
||||
#define EDGE_MIN_DIST 200 // distance (in internal units) to detect a zone outline
|
||||
int min_dist = EDGE_MIN_DIST+1;
|
||||
|
||||
|
||||
#if 0
|
||||
// Dick: I don't see this as reasonable. The mouse distance from the zone is
|
||||
// not a function of the grid, it is a fixed number of pixels, regardless of zoom.
|
||||
if( GetBoard() && GetBoard()->m_PcbFrame )
|
||||
{
|
||||
// Use grid size because it is known
|
||||
wxRealPoint grid = GetBoard()->m_PcbFrame->GetCanvas()->GetGrid();
|
||||
min_dist = KiROUND( MIN( grid.x, grid.y ) );
|
||||
}
|
||||
#endif
|
||||
// distance (in internal units) to detect a zone outline
|
||||
int min_dist = MIN_DIST_IN_MILS*IU_PER_MILS;
|
||||
|
||||
unsigned first_corner_pos = 0;
|
||||
|
||||
|
@ -915,6 +890,24 @@ ZoneConnection ZONE_CONTAINER::GetPadConnection( D_PAD* aPad ) const
|
|||
}
|
||||
|
||||
|
||||
void ZONE_CONTAINER::AddPolygon( std::vector< wxPoint >& aPolygon )
|
||||
{
|
||||
if( aPolygon.empty() )
|
||||
return;
|
||||
|
||||
for( unsigned i = 0; i < aPolygon.size(); i++ )
|
||||
{
|
||||
if( i == 0 )
|
||||
m_Poly->Start( GetLayer(), aPolygon[i].x, aPolygon[i].y, GetHatchStyle() );
|
||||
else
|
||||
AppendCorner( aPolygon[i] );
|
||||
}
|
||||
|
||||
m_Poly->Close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxString ZONE_CONTAINER::GetSelectMenuText() const
|
||||
{
|
||||
wxString text;
|
||||
|
|
|
@ -209,6 +209,7 @@ public:
|
|||
const wxString& GetNetName() const { return m_Netname; };
|
||||
void SetNetName( const wxString& aName ) { m_Netname = aName; }
|
||||
|
||||
/// How to fill areas: 0 = use filled polygons, 1 => fill with segments.
|
||||
void SetFillMode( int aFillMode ) { m_FillMode = aFillMode; }
|
||||
int GetFillMode() const { return m_FillMode; }
|
||||
|
||||
|
@ -429,6 +430,11 @@ public:
|
|||
return m_Poly->GetHatchStyle();
|
||||
}
|
||||
|
||||
void SetHatchStyle( CPolyLine::hatch_style aStyle )
|
||||
{
|
||||
m_Poly->SetHatchStyle( aStyle );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function TransformShapeWithClearanceToPolygon
|
||||
* Convert the track shape to a closed polygon
|
||||
|
@ -505,16 +511,25 @@ public:
|
|||
|
||||
void SetCornerRadius( unsigned int aRadius )
|
||||
{
|
||||
if( aRadius > MAX_ZONE_CORNER_RADIUS )
|
||||
cornerRadius = MAX_ZONE_CORNER_RADIUS;
|
||||
else if( aRadius < 0 )
|
||||
cornerRadius = 0;
|
||||
else
|
||||
cornerRadius = aRadius;
|
||||
cornerRadius = aRadius;
|
||||
if( cornerRadius > (unsigned int) Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS ) )
|
||||
cornerRadius = Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS );
|
||||
};
|
||||
|
||||
unsigned int GetCornerRadius() const { return cornerRadius; };
|
||||
|
||||
void AddPolygon( std::vector< wxPoint >& aPolygon );
|
||||
|
||||
void AddFilledPolygon( std::vector< CPolyPt >& aPolygon )
|
||||
{
|
||||
m_FilledPolysList.insert( m_FilledPolysList.end(), aPolygon.begin(), aPolygon.end() );
|
||||
}
|
||||
|
||||
void AddFillSegments( std::vector< SEGMENT >& aSegments )
|
||||
{
|
||||
m_FillSegmList.insert( m_FillSegmList.end(), aSegments.begin(), aSegments.end() );
|
||||
}
|
||||
|
||||
virtual wxString GetSelectMenuText() const;
|
||||
|
||||
virtual BITMAP_DEF GetMenuImage() const { return add_zone_xpm; }
|
||||
|
@ -533,7 +548,7 @@ public:
|
|||
int m_ZoneClearance; // clearance value
|
||||
int m_ZoneMinThickness; // Min thickness value in filled areas
|
||||
|
||||
// How to fill areas: 0 = use filled polygons, != 0 fill with segments.
|
||||
/// How to fill areas: 0 => use filled polygons, 1 => fill with segments.
|
||||
int m_FillMode;
|
||||
|
||||
// number of segments to convert a circle to a polygon (uses
|
||||
|
|
|
@ -1,18 +1,31 @@
|
|||
/******************************************************/
|
||||
/* class ZONE_SETTINGS used to handle zones parameters */
|
||||
/******************************************************/
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
/* For compilers that support precompilation:
|
||||
/**
|
||||
* @brief class ZONE_SETTINGS used to handle zones parameters
|
||||
*/
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2012 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
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
|
||||
|
@ -86,5 +99,6 @@ void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) c
|
|||
aTarget.SetPriority( m_ZonePriority );
|
||||
aTarget.SetNet( m_NetcodeSelection );
|
||||
aTarget.SetLayer( m_CurrentZone_Layer );
|
||||
aTarget.m_Poly->SetLayer( m_CurrentZone_Layer );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
class ZONE_CONTAINER;
|
||||
|
||||
|
||||
#define MAX_ZONE_CORNER_RADIUS 4000
|
||||
#define MAX_ZONE_CORNER_RADIUS_MILS 400
|
||||
|
||||
|
||||
/**
|
||||
|
@ -83,8 +83,8 @@ public:
|
|||
|
||||
void SetCornerRadius( int aRadius )
|
||||
{
|
||||
if( aRadius > MAX_ZONE_CORNER_RADIUS )
|
||||
cornerRadius = MAX_ZONE_CORNER_RADIUS;
|
||||
if( aRadius > Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS ) )
|
||||
cornerRadius = Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS );
|
||||
else if( aRadius < 0 )
|
||||
cornerRadius = 0;
|
||||
else
|
||||
|
|
|
@ -4,6 +4,32 @@
|
|||
* except for tracks (see class_track.cpp).
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
#include <macros.h>
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2011 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
@ -1074,6 +1075,10 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
|
|||
*/
|
||||
static bool SortTracksByNetCode( const TRACK* const & ref, const TRACK* const & compare )
|
||||
{
|
||||
// For items having the same Net, keep the order in list
|
||||
if( ref->GetNet() == compare->GetNet())
|
||||
return ref->m_Param < compare->m_Param;
|
||||
|
||||
return ref->GetNet() < compare->GetNet();
|
||||
}
|
||||
|
||||
|
@ -1081,6 +1086,7 @@ static bool SortTracksByNetCode( const TRACK* const & ref, const TRACK* const &
|
|||
* Helper function RebuildTrackChain
|
||||
* rebuilds the track segment linked list in order to have a chain
|
||||
* sorted by increasing netcodes.
|
||||
* We try to keep order of track segments in list, when possible
|
||||
* @param pcb = board to rebuild
|
||||
*/
|
||||
static void RebuildTrackChain( BOARD* pcb )
|
||||
|
@ -1093,8 +1099,19 @@ static void RebuildTrackChain( BOARD* pcb )
|
|||
std::vector<TRACK*> trackList;
|
||||
trackList.reserve( item_count );
|
||||
|
||||
for( int i = 0; i < item_count; ++i )
|
||||
// Put track list in a temporary list to sort tracks by netcode
|
||||
// We try to keep the initial order of track segments in list, when possible
|
||||
// so we use m_Param (a member variable used for temporary storage)
|
||||
// to temporary keep trace of the order of segments
|
||||
// The sort function uses this variable to sort items that
|
||||
// have the same net code.
|
||||
// Without this, during sorting, the initial order is sometimes lost
|
||||
// by the sort algorithm
|
||||
for( int ii = 0; ii < item_count; ++ii )
|
||||
{
|
||||
pcb->m_Track->m_Param = ii;
|
||||
trackList.push_back( pcb->m_Track.PopFront() );
|
||||
}
|
||||
|
||||
// the list is empty now
|
||||
wxASSERT( pcb->m_Track == NULL && pcb->m_Track.GetCount()==0 );
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
|
|
@ -370,7 +370,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
|
|||
|
||||
// Test if this is a reasonable value for this parameter
|
||||
// A too large value can hang Pcbnew
|
||||
#define CLEARANCE_MAX_VALUE 5000 // in 1/10000 inch
|
||||
#define CLEARANCE_MAX_VALUE 100*IU_PER_MILS
|
||||
if( m_settings.m_ZoneClearance > CLEARANCE_MAX_VALUE )
|
||||
{
|
||||
DisplayError( this, _( "Clearance must be smaller than 0.5\" / 12.7 mm." ) );
|
||||
|
@ -380,7 +380,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
|
|||
txtvalue = m_ZoneMinThicknessCtrl->GetValue();
|
||||
m_settings.m_ZoneMinThickness = ReturnValueFromString( g_UserUnit, txtvalue );
|
||||
|
||||
if( m_settings.m_ZoneMinThickness < 10 )
|
||||
if( m_settings.m_ZoneMinThickness < (1*IU_PER_MILS) )
|
||||
{
|
||||
DisplayError( this,
|
||||
_( "Minimum width must be larger than 0.001\" / 0.0254 mm." ) );
|
||||
|
|
|
@ -2,6 +2,32 @@
|
|||
* Module editor: Dialog box for editing module properties in the pcb editor. *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2011 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2012 Dick Hollenbeck, dick@softplc.com
|
||||
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <gr_basic.h>
|
||||
#include <class_drawpanel.h>
|
||||
|
|
|
@ -1,70 +1,73 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Aug 24 2011)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_find_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_FIND_BASE::DIALOG_FIND_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* bSizerMain;
|
||||
bSizerMain = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bSizer3;
|
||||
bSizer3 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Search for:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText1->Wrap( -1 );
|
||||
bSizer3->Add( m_staticText1, 0, wxALL, 5 );
|
||||
|
||||
m_SearchTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 200,-1 ), 0 );
|
||||
bSizer3->Add( m_SearchTextCtrl, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_NoMouseWarpCheckBox = new wxCheckBox( this, wxID_ANY, _("Do not warp mouse pointer"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer3->Add( m_NoMouseWarpCheckBox, 0, wxALL, 5 );
|
||||
|
||||
bSizerMain->Add( bSizer3, 1, 0, 5 );
|
||||
|
||||
wxBoxSizer* bSizer4;
|
||||
bSizer4 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_button1 = new wxButton( this, wxID_ANY, _("Find Item"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_button1->SetDefault();
|
||||
bSizer4->Add( m_button1, 0, wxALL, 5 );
|
||||
|
||||
m_button2 = new wxButton( this, wxID_ANY, _("Find Marker"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer4->Add( m_button2, 0, wxALL, 5 );
|
||||
|
||||
m_button3 = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer4->Add( m_button3, 0, wxALL, 5 );
|
||||
|
||||
bSizerMain->Add( bSizer4, 0, 0, 5 );
|
||||
|
||||
this->SetSizer( bSizerMain );
|
||||
this->Layout();
|
||||
bSizerMain->Fit( this );
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIND_BASE::onClose ) );
|
||||
m_button1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindItemClick ), NULL, this );
|
||||
m_button2->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindMarkerClick ), NULL, this );
|
||||
m_button3->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonCloseClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_FIND_BASE::~DIALOG_FIND_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIND_BASE::onClose ) );
|
||||
m_button1->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindItemClick ), NULL, this );
|
||||
m_button2->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindMarkerClick ), NULL, this );
|
||||
m_button3->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonCloseClick ), NULL, this );
|
||||
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Apr 10 2012)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_find_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_FIND_BASE::DIALOG_FIND_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* bSizerMain;
|
||||
bSizerMain = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bSizer3;
|
||||
bSizer3 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Search for:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText1->Wrap( -1 );
|
||||
bSizer3->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_SearchTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 200,-1 ), 0 );
|
||||
bSizer3->Add( m_SearchTextCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_NoMouseWarpCheckBox = new wxCheckBox( this, wxID_ANY, _("Do not warp mouse pointer"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer3->Add( m_NoMouseWarpCheckBox, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( bSizer3, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
wxBoxSizer* bSizer4;
|
||||
bSizer4 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_button1 = new wxButton( this, wxID_ANY, _("Find Item"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_button1->SetDefault();
|
||||
bSizer4->Add( m_button1, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_button2 = new wxButton( this, wxID_ANY, _("Find Marker"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer4->Add( m_button2, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_button3 = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer4->Add( m_button3, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( bSizer4, 0, wxALL, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerMain );
|
||||
this->Layout();
|
||||
bSizerMain->Fit( this );
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIND_BASE::onClose ) );
|
||||
m_button1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindItemClick ), NULL, this );
|
||||
m_button2->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindMarkerClick ), NULL, this );
|
||||
m_button3->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonCloseClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_FIND_BASE::~DIALOG_FIND_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIND_BASE::onClose ) );
|
||||
m_button1->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindItemClick ), NULL, this );
|
||||
m_button2->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindMarkerClick ), NULL, this );
|
||||
m_button3->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonCloseClick ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,61 +1,59 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Aug 24 2011)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DIALOG_FIND_BASE_H__
|
||||
#define __DIALOG_FIND_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class DIALOG_SHIM;
|
||||
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_FIND_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_FIND_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticText1;
|
||||
wxTextCtrl* m_SearchTextCtrl;
|
||||
wxCheckBox* m_NoMouseWarpCheckBox;
|
||||
wxButton* m_button1;
|
||||
wxButton* m_button2;
|
||||
wxButton* m_button3;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void onClose( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void onButtonFindItemClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onButtonFindMarkerClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onButtonCloseClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_FIND_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__DIALOG_FIND_BASE_H__
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Apr 10 2012)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DIALOG_FIND_BASE_H__
|
||||
#define __DIALOG_FIND_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_FIND_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_FIND_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticText1;
|
||||
wxTextCtrl* m_SearchTextCtrl;
|
||||
wxCheckBox* m_NoMouseWarpCheckBox;
|
||||
wxButton* m_button1;
|
||||
wxButton* m_button2;
|
||||
wxButton* m_button3;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void onClose( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void onButtonFindItemClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onButtonFindMarkerClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onButtonCloseClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_FIND_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__DIALOG_FIND_BASE_H__
|
||||
|
|
|
@ -660,8 +660,8 @@ bool DIALOG_LAYERS_SETUP::testLayerNames()
|
|||
// 3) cannot have " chars
|
||||
// 4) cannot be 'signal'
|
||||
// 5) must be unique.
|
||||
|
||||
static const wxString badchars( wxT("%$\" ") );
|
||||
// 6) cannot have illegal chars in filenames ( some filenames are built from layer names )
|
||||
static const wxString badchars( wxT("%$\" /\\.") );
|
||||
|
||||
if( name == wxEmptyString )
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,6 +3,31 @@
|
|||
* @brief Dialog and code for editing a dimension object.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2012 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
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <confirm.h>
|
||||
#include <gr_basic.h>
|
||||
|
|
|
@ -77,6 +77,20 @@ Load() TODO's
|
|||
|
||||
using namespace boost::property_tree;
|
||||
|
||||
typedef EAGLE_PLUGIN::BIU BIU;
|
||||
typedef PTREE::const_assoc_iterator CA_ITER;
|
||||
typedef PTREE::const_iterator CITER;
|
||||
typedef std::pair<CA_ITER, CA_ITER> CA_ITER_RANGE;
|
||||
|
||||
typedef MODULE_MAP::iterator MODULE_ITER;
|
||||
typedef MODULE_MAP::const_iterator MODULE_CITER;
|
||||
|
||||
typedef boost::optional<std::string> opt_string;
|
||||
typedef boost::optional<int> opt_int;
|
||||
typedef boost::optional<double> opt_double;
|
||||
typedef boost::optional<bool> opt_bool;
|
||||
|
||||
|
||||
/// segment (element) of our XPATH into the Eagle XML document tree in PTREE form.
|
||||
struct TRIPLET
|
||||
{
|
||||
|
@ -160,20 +174,6 @@ public:
|
|||
};
|
||||
|
||||
|
||||
typedef EAGLE_PLUGIN::BIU BIU;
|
||||
typedef PTREE::const_assoc_iterator CA_ITER;
|
||||
typedef PTREE::const_iterator CITER;
|
||||
typedef std::pair<CA_ITER, CA_ITER> CA_ITER_RANGE;
|
||||
|
||||
typedef MODULE_MAP::iterator MODULE_ITER;
|
||||
typedef MODULE_MAP::const_iterator MODULE_CITER;
|
||||
|
||||
typedef boost::optional<std::string> opt_string;
|
||||
typedef boost::optional<int> opt_int;
|
||||
typedef boost::optional<double> opt_double;
|
||||
typedef boost::optional<bool> opt_bool;
|
||||
|
||||
|
||||
/**
|
||||
* Function parseOptionalBool
|
||||
* returns an opt_bool and sets it true or false according to the presence
|
||||
|
@ -205,13 +205,23 @@ struct EROT
|
|||
bool spin;
|
||||
double degrees;
|
||||
|
||||
EROT() : mirror( false ), spin( false ), degrees( 0 ) {}
|
||||
EROT() :
|
||||
mirror( false ),
|
||||
spin( false ),
|
||||
degrees( 0 )
|
||||
{}
|
||||
|
||||
EROT( double aDegrees ) :
|
||||
mirror( false ),
|
||||
spin( false ),
|
||||
degrees( aDegrees )
|
||||
{}
|
||||
};
|
||||
|
||||
typedef boost::optional<EROT> opt_erot;
|
||||
|
||||
/// parse an Eagle XML "rot" field. Unfortunately the DTD seems not to explain
|
||||
/// this format very well. R[S][M]<degrees>. Examples: "R90", "MR180", "SR180"
|
||||
/// this format very well. [S][M]R<degrees>. Examples: "R90", "MR180", "SR180"
|
||||
static EROT erot( const std::string& aRot )
|
||||
{
|
||||
EROT rot;
|
||||
|
@ -239,12 +249,30 @@ static opt_erot parseOptionalEROT( CPTREE& attribs )
|
|||
/// Eagle wire
|
||||
struct EWIRE
|
||||
{
|
||||
double x1;
|
||||
double y1;
|
||||
double x2;
|
||||
double y2;
|
||||
double width;
|
||||
int layer;
|
||||
double x1;
|
||||
double y1;
|
||||
double x2;
|
||||
double y2;
|
||||
double width;
|
||||
int layer;
|
||||
|
||||
// for style: (continuous | longdash | shortdash | dashdot)
|
||||
enum {
|
||||
CONTINUOUS,
|
||||
LONGDASH,
|
||||
SHORTDASH,
|
||||
DASHDOT,
|
||||
};
|
||||
opt_int style;
|
||||
opt_double curve; ///< range is -359.9..359.9
|
||||
|
||||
// for cap: (flat | round)
|
||||
enum {
|
||||
FLAT,
|
||||
ROUND,
|
||||
};
|
||||
opt_int cap;
|
||||
|
||||
EWIRE( CPTREE& aWire );
|
||||
};
|
||||
|
||||
|
@ -280,7 +308,30 @@ EWIRE::EWIRE( CPTREE& aWire )
|
|||
width = attribs.get<double>( "width" );
|
||||
layer = attribs.get<int>( "layer" );
|
||||
|
||||
// ignoring extent, style, curve and cap
|
||||
curve = attribs.get_optional<double>( "curve" );
|
||||
|
||||
opt_string s = attribs.get_optional<std::string>( "style" );
|
||||
if( s )
|
||||
{
|
||||
if( !s->compare( "continuous" ) )
|
||||
style = EWIRE::CONTINUOUS;
|
||||
else if( !s->compare( "longdash" ) )
|
||||
style = EWIRE::LONGDASH;
|
||||
else if( !s->compare( "shortdash" ) )
|
||||
style = EWIRE::SHORTDASH;
|
||||
else if( !s->compare( "dashdot" ) )
|
||||
style = EWIRE::DASHDOT;
|
||||
}
|
||||
|
||||
s = attribs.get_optional<std::string>( "cap" );
|
||||
if( s )
|
||||
{
|
||||
if( !s->compare( "round" ) )
|
||||
cap = EWIRE::ROUND;
|
||||
else if( !s->compare( "flat" ) )
|
||||
cap = EWIRE::FLAT;
|
||||
}
|
||||
// ignoring extent
|
||||
}
|
||||
|
||||
|
||||
|
@ -411,16 +462,17 @@ struct EATTR
|
|||
opt_int layer;
|
||||
opt_double ratio;
|
||||
opt_erot rot;
|
||||
opt_int display;
|
||||
|
||||
enum { // for 'display' field above
|
||||
enum { // for 'display'
|
||||
Off,
|
||||
VALUE,
|
||||
NAME,
|
||||
BOTH,
|
||||
};
|
||||
opt_int display;
|
||||
|
||||
EATTR( CPTREE& aTree );
|
||||
EATTR() {}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -900,6 +952,85 @@ ELAYER::ELAYER( CPTREE& aLayer )
|
|||
}
|
||||
|
||||
|
||||
/// parse an eagle distance which is either straight mm or mils if there is "mil" suffix.
|
||||
static double parseEagle( const std::string& aDistance )
|
||||
{
|
||||
double ret = strtod( aDistance.c_str(), NULL );
|
||||
if( aDistance.npos != aDistance.find( "mil" ) )
|
||||
ret = IU_PER_MILS * ret;
|
||||
else
|
||||
ret = IU_PER_MM * ret;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/// subset of eagle.drawing.board.designrules in the XML document
|
||||
struct ERULES
|
||||
{
|
||||
int psElongationLong; ///< percent over 100%. 0-> not elongated, 100->twice as wide as is tall
|
||||
///< Goes into making a scaling factor for "long" pads.
|
||||
|
||||
int psElongationOffset; ///< the offset of the hole within the "long" pad.
|
||||
|
||||
double rvPadTop; ///< top pad size as percent of drill size
|
||||
// double rvPadBottom; ///< bottom pad size as percent of drill size
|
||||
|
||||
double rlMinPadTop; ///< minimum copper annulus on through hole pads
|
||||
double rlMaxPadTop; ///< maximum copper annulus on through hole pads
|
||||
|
||||
double rvViaOuter; ///< copper annulus is this percent of via hole
|
||||
double rlMinViaOuter; ///< minimum copper annulus on via
|
||||
double rlMaxViaOuter; ///< maximum copper annulus on via
|
||||
|
||||
|
||||
ERULES() :
|
||||
psElongationLong ( 100 ),
|
||||
rvPadTop ( 0.25 ),
|
||||
// rvPadBottom ( 0.25 ),
|
||||
rlMinPadTop ( Mils2iu( 10 ) ),
|
||||
rlMaxPadTop ( Mils2iu( 20 ) ),
|
||||
|
||||
rvViaOuter ( 0.25 ),
|
||||
rlMinViaOuter ( Mils2iu( 10 ) ),
|
||||
rlMaxViaOuter ( Mils2iu( 20 ) )
|
||||
{}
|
||||
|
||||
void parse( CPTREE& aRules );
|
||||
};
|
||||
|
||||
void ERULES::parse( CPTREE& aRules )
|
||||
{
|
||||
for( CITER it = aRules.begin(); it != aRules.end(); ++it )
|
||||
{
|
||||
if( it->first.compare( "param" ) )
|
||||
continue;
|
||||
|
||||
CPTREE& attribs = it->second.get_child( "<xmlattr>" );
|
||||
|
||||
const std::string& name = attribs.get<std::string>( "name" );
|
||||
|
||||
if( !name.compare( "psElongationLong" ) )
|
||||
psElongationLong = attribs.get<int>( "value" );
|
||||
else if( !name.compare( "psElongationOffset" ) )
|
||||
psElongationOffset = attribs.get<int>( "value" );
|
||||
else if( !name.compare( "rvPadTop" ) )
|
||||
rvPadTop = attribs.get<double>( "value" );
|
||||
else if( !name.compare( "rlMinPadTop" ) )
|
||||
rlMinPadTop = parseEagle( attribs.get<std::string>( "value" ) );
|
||||
else if( !name.compare( "rlMaxPadTop" ) )
|
||||
rlMaxPadTop = parseEagle( attribs.get<std::string>( "value" ) );
|
||||
|
||||
else if( !name.compare( "rvViaOuter" ) )
|
||||
rvViaOuter = attribs.get<double>( "value" );
|
||||
else if( !name.compare( "rlMinViaOuter" ) )
|
||||
rlMinViaOuter = parseEagle( attribs.get<std::string>( "value" ) );
|
||||
else if( !name.compare( "rlMaxViaOuter" ) )
|
||||
rlMaxViaOuter = parseEagle( attribs.get<std::string>( "value" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Assemble a two part key as a simple concatonation of aFirst and aSecond parts,
|
||||
/// using a separator.
|
||||
static inline std::string makeKey( const std::string& aFirst, const std::string& aSecond )
|
||||
|
@ -918,6 +1049,7 @@ static inline unsigned long timeStamp( CPTREE& aTree )
|
|||
|
||||
|
||||
EAGLE_PLUGIN::EAGLE_PLUGIN() :
|
||||
m_rules( new ERULES() ),
|
||||
m_xpath( new XPATH() )
|
||||
{
|
||||
init( NULL );
|
||||
|
@ -926,6 +1058,7 @@ EAGLE_PLUGIN::EAGLE_PLUGIN() :
|
|||
|
||||
EAGLE_PLUGIN::~EAGLE_PLUGIN()
|
||||
{
|
||||
delete m_rules;
|
||||
delete m_xpath;
|
||||
}
|
||||
|
||||
|
@ -1026,21 +1159,34 @@ void EAGLE_PLUGIN::init( PROPERTIES* aProperties )
|
|||
|
||||
mm_per_biu = 1/IU_PER_MM;
|
||||
biu_per_mm = IU_PER_MM;
|
||||
|
||||
delete m_rules;
|
||||
m_rules = new ERULES();
|
||||
}
|
||||
|
||||
|
||||
void EAGLE_PLUGIN::loadAllSections( CPTREE& aDoc )
|
||||
{
|
||||
CPTREE& drawing = aDoc.get_child( "eagle.drawing" );
|
||||
CPTREE& board = drawing.get_child( "board" );
|
||||
|
||||
m_xpath->push( "eagle.drawing" );
|
||||
|
||||
{
|
||||
m_xpath->push( "board" );
|
||||
|
||||
CPTREE& designrules = board.get_child( "designrules" );
|
||||
loadDesignRules( designrules );
|
||||
|
||||
m_xpath->pop();
|
||||
}
|
||||
|
||||
{
|
||||
CPTREE& layers = drawing.get_child( "layers" );
|
||||
loadLayerDefs( layers );
|
||||
}
|
||||
|
||||
{
|
||||
CPTREE& board = drawing.get_child( "board" );
|
||||
m_xpath->push( "board" );
|
||||
|
||||
CPTREE& plain = board.get_child( "plain" );
|
||||
|
@ -1062,6 +1208,14 @@ void EAGLE_PLUGIN::loadAllSections( CPTREE& aDoc )
|
|||
}
|
||||
|
||||
|
||||
void EAGLE_PLUGIN::loadDesignRules( CPTREE& aDesignRules )
|
||||
{
|
||||
m_xpath->push( "designrules" );
|
||||
m_rules->parse( aDesignRules );
|
||||
m_xpath->pop(); // "designrules"
|
||||
}
|
||||
|
||||
|
||||
void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers )
|
||||
{
|
||||
m_xpath->push( "layers.layer" );
|
||||
|
@ -1134,8 +1288,6 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics )
|
|||
ETEXT t( gr->second );
|
||||
int layer = kicad_layer( t.layer );
|
||||
|
||||
int sign = 1;
|
||||
|
||||
TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_board );
|
||||
m_board->Add( pcbtxt, ADD_APPEND );
|
||||
|
||||
|
@ -1150,34 +1302,29 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics )
|
|||
|
||||
pcbtxt->SetThickness( kicad( t.size * ratio / 100 ) );
|
||||
|
||||
if( t.rot )
|
||||
{
|
||||
#if 0
|
||||
if( t.rot->spin || ( t.rot->degrees != 180 && t.rot->degrees != 270 ) )
|
||||
pcbtxt->SetOrientation( t.rot->degrees * 10 );
|
||||
|
||||
else
|
||||
// flip the justification to opposite
|
||||
sign = -1;
|
||||
#else
|
||||
// eagles does not rotate text spun to 180 degrees unless spin is set.
|
||||
if( t.rot->spin || t.rot->degrees != 180 )
|
||||
pcbtxt->SetOrientation( t.rot->degrees * 10 );
|
||||
|
||||
else
|
||||
// flip the justification to opposite
|
||||
sign = -1;
|
||||
|
||||
if( t.rot->degrees == 270 )
|
||||
sign = -1;
|
||||
#endif
|
||||
pcbtxt->SetMirrored( t.rot->mirror );
|
||||
|
||||
}
|
||||
|
||||
int align = t.align ? *t.align : ETEXT::BOTTOM_LEFT;
|
||||
|
||||
switch( align * sign ) // if negative, opposite is chosen
|
||||
if( t.rot )
|
||||
{
|
||||
int sign = t.rot->mirror ? -1 : 1;
|
||||
pcbtxt->SetMirrored( t.rot->mirror );
|
||||
|
||||
double degrees = t.rot->degrees;
|
||||
|
||||
if( degrees == 90 || t.rot->spin )
|
||||
pcbtxt->SetOrientation( sign * t.rot->degrees * 10 );
|
||||
|
||||
else if( degrees == 180 )
|
||||
align = ETEXT::TOP_RIGHT;
|
||||
|
||||
else if( degrees == 270 )
|
||||
{
|
||||
pcbtxt->SetOrientation( sign * 90 * 10 );
|
||||
align = ETEXT::TOP_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
switch( align )
|
||||
{
|
||||
case ETEXT::CENTER:
|
||||
// this was the default in pcbtxt's constructor
|
||||
|
@ -1398,6 +1545,9 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements )
|
|||
{
|
||||
m_xpath->push( "elements.element", "name" );
|
||||
|
||||
EATTR name;
|
||||
EATTR value;
|
||||
|
||||
for( CITER it = aElements.begin(); it != aElements.end(); ++it )
|
||||
{
|
||||
if( it->first.compare( "element" ) )
|
||||
|
@ -1405,6 +1555,10 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements )
|
|||
|
||||
EELEMENT e( it->second );
|
||||
|
||||
// use "NULL-ness" as an indiation of presence of the attribute:
|
||||
EATTR* nameAttr = 0;
|
||||
EATTR* valueAttr = 0;
|
||||
|
||||
m_xpath->Value( e.name.c_str() );
|
||||
|
||||
#if 1 && defined(DEBUG)
|
||||
|
@ -1428,13 +1582,12 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements )
|
|||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
if( !e.name.compare( "ATMEGA328" ) )
|
||||
if( !e.name.compare( "IC3" ) )
|
||||
{
|
||||
int breakhere = 1;
|
||||
(void) breakhere;
|
||||
}
|
||||
#endif
|
||||
|
||||
// copy constructor to clone the template
|
||||
MODULE* m = new MODULE( *mi->second );
|
||||
m_board->Add( m, ADD_APPEND );
|
||||
|
@ -1458,16 +1611,7 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements )
|
|||
m->SetValue( FROM_UTF8( e.value.c_str() ) );
|
||||
// m->Value().SetVisible( false );
|
||||
|
||||
if( e.rot )
|
||||
{
|
||||
m->SetOrientation( e.rot->degrees * 10 );
|
||||
|
||||
if( e.rot->mirror )
|
||||
{
|
||||
m->Flip( m->GetPosition() );
|
||||
}
|
||||
}
|
||||
|
||||
// initalize these to default values incase the <attribute> elements are not present.
|
||||
m_xpath->push( "attribute", "name" );
|
||||
|
||||
// VALUE and NAME can have something like our text "effects" overrides
|
||||
|
@ -1483,82 +1627,154 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements )
|
|||
|
||||
EATTR a( ait->second );
|
||||
|
||||
TEXTE_MODULE* txt;
|
||||
|
||||
if( !a.name.compare( "NAME" ) )
|
||||
txt = &m->Reference();
|
||||
{
|
||||
name = a;
|
||||
nameAttr = &name;
|
||||
}
|
||||
else if( !a.name.compare( "VALUE" ) )
|
||||
txt = &m->Value();
|
||||
else
|
||||
{
|
||||
// our understanding of file format is incomplete?
|
||||
continue;
|
||||
value = a;
|
||||
valueAttr = &value;
|
||||
}
|
||||
|
||||
m_xpath->Value( a.name.c_str() );
|
||||
|
||||
if( a.value )
|
||||
{
|
||||
txt->SetText( FROM_UTF8( a.value->c_str() ) );
|
||||
}
|
||||
|
||||
if( a.x && a.y ) // boost::optional
|
||||
{
|
||||
wxPoint pos( kicad_x( *a.x ), kicad_y( *a.y ) );
|
||||
wxPoint pos0 = pos - m->GetPosition();
|
||||
|
||||
txt->SetPosition( pos );
|
||||
txt->SetPos0( pos0 );
|
||||
}
|
||||
|
||||
// Even though size and ratio are both optional, I am not seeing
|
||||
// a case where ratio is present but size is not.
|
||||
|
||||
if( a.size )
|
||||
{
|
||||
wxSize fontz = kicad_fontz( *a.size );
|
||||
txt->SetSize( fontz );
|
||||
|
||||
if( a.ratio )
|
||||
{
|
||||
double ratio = *a.ratio;
|
||||
int lw = int( fontz.y * ratio / 100.0 );
|
||||
txt->SetThickness( lw );
|
||||
}
|
||||
}
|
||||
|
||||
// The "rot" in a EATTR seems to be assumed to be zero if it is not
|
||||
// present, and this zero rotation becomes an override to the
|
||||
// package's text field. If they did not want zero, they specify
|
||||
// what they want explicitly.
|
||||
EROT rot;
|
||||
|
||||
if( a.rot )
|
||||
rot = *a.rot;
|
||||
|
||||
if( rot.spin || (rot.degrees != 180 && rot.degrees != 270) )
|
||||
{
|
||||
double angle = rot.degrees * 10;
|
||||
angle -= m->GetOrientation(); // subtract module's angle
|
||||
txt->SetOrientation( angle );
|
||||
}
|
||||
else
|
||||
{
|
||||
// ETEXT::TOP_RIGHT:
|
||||
txt->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
||||
txt->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
|
||||
}
|
||||
|
||||
txt->SetMirrored( rot.mirror );
|
||||
}
|
||||
|
||||
m_xpath->pop(); // "attribute"
|
||||
|
||||
orientModuleAndText( m, e, nameAttr, valueAttr );
|
||||
}
|
||||
|
||||
m_xpath->pop(); // "elements.element"
|
||||
}
|
||||
|
||||
|
||||
void EAGLE_PLUGIN::orientModuleAndText( MODULE* m, const EELEMENT& e,
|
||||
const EATTR* nameAttr, const EATTR* valueAttr )
|
||||
{
|
||||
if( e.rot )
|
||||
{
|
||||
if( e.rot->mirror )
|
||||
{
|
||||
m->Flip( m->GetPosition() );
|
||||
}
|
||||
m->SetOrientation( e.rot->degrees * 10 );
|
||||
}
|
||||
|
||||
orientModuleText( m, e, &m->Reference(), nameAttr );
|
||||
orientModuleText( m, e, &m->Value(), valueAttr );
|
||||
}
|
||||
|
||||
|
||||
void EAGLE_PLUGIN::orientModuleText( MODULE* m, const EELEMENT& e,
|
||||
TEXTE_MODULE* txt, const EATTR* aAttr )
|
||||
{
|
||||
if( aAttr )
|
||||
{
|
||||
const EATTR& a = *aAttr;
|
||||
|
||||
if( a.value )
|
||||
{
|
||||
txt->SetText( FROM_UTF8( a.value->c_str() ) );
|
||||
}
|
||||
|
||||
if( a.x && a.y ) // boost::optional
|
||||
{
|
||||
wxPoint pos( kicad_x( *a.x ), kicad_y( *a.y ) );
|
||||
wxPoint pos0 = pos - m->GetPosition();
|
||||
|
||||
txt->SetPosition( pos );
|
||||
txt->SetPos0( pos0 );
|
||||
}
|
||||
|
||||
// Even though size and ratio are both optional, I am not seeing
|
||||
// a case where ratio is present but size is not.
|
||||
double ratio = 8;
|
||||
wxSize fontz = txt->GetSize();
|
||||
|
||||
if( a.size )
|
||||
{
|
||||
fontz = kicad_fontz( *a.size );
|
||||
txt->SetSize( fontz );
|
||||
|
||||
if( a.ratio )
|
||||
ratio = *a.ratio;
|
||||
}
|
||||
|
||||
int lw = int( fontz.y * ratio / 100.0 );
|
||||
txt->SetThickness( lw );
|
||||
|
||||
int align = ETEXT::BOTTOM_LEFT; // bottom-left is eagle default
|
||||
|
||||
// The "rot" in a EATTR seems to be assumed to be zero if it is not
|
||||
// present, and this zero rotation becomes an override to the
|
||||
// package's text field. If they did not want zero, they specify
|
||||
// what they want explicitly.
|
||||
double degrees = a.rot ? a.rot->degrees : 0;
|
||||
double orient; // relative to parent
|
||||
|
||||
int sign = 1;
|
||||
bool spin = false;
|
||||
|
||||
if( a.rot )
|
||||
{
|
||||
spin = a.rot->spin;
|
||||
sign = a.rot->mirror ? -1 : 1;
|
||||
txt->SetMirrored( a.rot->mirror );
|
||||
}
|
||||
|
||||
if( degrees == 90 || degrees == 0 || spin )
|
||||
{
|
||||
orient = degrees - m->GetOrientation() / 10;
|
||||
txt->SetOrientation( sign * orient * 10 );
|
||||
}
|
||||
|
||||
else if( degrees == 180 )
|
||||
{
|
||||
orient = 0 - m->GetOrientation() / 10;
|
||||
txt->SetOrientation( sign * orient * 10 );
|
||||
align = ETEXT::TOP_RIGHT;
|
||||
}
|
||||
|
||||
else if( degrees == 270 )
|
||||
{
|
||||
orient = 90 - m->GetOrientation() / 10;
|
||||
align = ETEXT::TOP_RIGHT;
|
||||
txt->SetOrientation( sign * orient * 10 );
|
||||
}
|
||||
|
||||
switch( align )
|
||||
{
|
||||
case ETEXT::TOP_RIGHT:
|
||||
txt->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
||||
txt->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
|
||||
break;
|
||||
|
||||
case ETEXT::BOTTOM_LEFT:
|
||||
txt->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||
txt->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
else // the text is per the original package, sans <attribute>
|
||||
{
|
||||
double degrees = ( txt->GetOrientation() + m->GetOrientation() ) / 10;
|
||||
|
||||
// @todo there are a few more cases than theses to contend with:
|
||||
if( (!txt->IsMirrored() && ( abs( degrees ) == 180 || abs( degrees ) == 270 ))
|
||||
|| ( txt->IsMirrored() && ( degrees == 360 ) ) )
|
||||
{
|
||||
// ETEXT::TOP_RIGHT:
|
||||
txt->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
||||
txt->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MODULE* EAGLE_PLUGIN::makeModule( CPTREE& aPackage, const std::string& aPkgName ) const
|
||||
{
|
||||
std::auto_ptr<MODULE> m( new MODULE( NULL ) );
|
||||
|
@ -1684,31 +1900,19 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, CPTREE& aTree ) const
|
|||
}
|
||||
else
|
||||
{
|
||||
// The pad size is optional in the eagle DTD, so we must guess.
|
||||
// Supply something here that is a minimum copper surround, or otherwise
|
||||
// 120% of drillz whichever is greater. But for PAD_OVAL, we can use
|
||||
// a smaller minimum than for a round pad, since there is a larger copper
|
||||
// body on the elongated ends.
|
||||
|
||||
int min_copper;
|
||||
|
||||
if( pad->GetShape() == PAD_OVAL )
|
||||
min_copper = Mils2iu( 4 );
|
||||
else
|
||||
min_copper = Mils2iu( 6 );
|
||||
|
||||
// minz copper surround as a minimum, otherwise 110% of drillz.
|
||||
int drillz = pad->GetDrillSize().x;
|
||||
int diameter = std::max( drillz + 2 * min_copper, int( drillz * 1.2 ) );
|
||||
|
||||
pad->SetSize( wxSize( diameter, diameter ) );
|
||||
double drillz = pad->GetDrillSize().x;
|
||||
double annulus = drillz * m_rules->rvPadTop; // copper annulus, eagle "restring"
|
||||
annulus = Clamp( m_rules->rlMinPadTop, annulus, m_rules->rlMaxPadTop );
|
||||
int diameter = KiROUND( drillz + 2 * annulus );
|
||||
pad->SetSize( wxSize( KiROUND( diameter ), KiROUND( diameter ) ) );
|
||||
}
|
||||
|
||||
if( pad->GetShape() == PAD_OVAL )
|
||||
{
|
||||
// The Eagle "long" pad seems to be tall, "width = height x 4/3" apparently.
|
||||
// The Eagle "long" pad is wider than it is tall,
|
||||
// m_elongation is percent elongation
|
||||
wxSize sz = pad->GetSize();
|
||||
sz.x = (sz.x * 4)/3;
|
||||
sz.x = ( sz.x * ( 100 + m_rules->psElongationLong ) ) / 100;
|
||||
pad->SetSize( sz );
|
||||
}
|
||||
|
||||
|
@ -1746,13 +1950,6 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, CPTREE& aTree ) const
|
|||
txt->SetPosition( pos );
|
||||
txt->SetPos0( pos - aModule->GetPosition() );
|
||||
|
||||
/*
|
||||
switch( layer )
|
||||
{
|
||||
case COMMENT_N: layer = SILKSCREEN_N_FRONT; break;
|
||||
}
|
||||
*/
|
||||
|
||||
txt->SetLayer( layer );
|
||||
|
||||
txt->SetSize( kicad_fontz( t.size ) );
|
||||
|
@ -1761,26 +1958,32 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, CPTREE& aTree ) const
|
|||
|
||||
txt->SetThickness( kicad( t.size * ratio / 100 ) );
|
||||
|
||||
double angle = t.rot ? t.rot->degrees * 10 : 0;
|
||||
int align = t.align ? *t.align : ETEXT::BOTTOM_LEFT; // bottom-left is eagle default
|
||||
|
||||
// An eagle package is never rotated, the DTD does not allow it.
|
||||
// angle -= aModule->GetOrienation();
|
||||
|
||||
int sign = 1;
|
||||
if( t.rot )
|
||||
{
|
||||
if( t.rot->spin || (angle != 1800 && angle != 2700) )
|
||||
txt->SetOrientation( angle );
|
||||
|
||||
else // 180 or 270 degrees, reverse justification below, don't spin
|
||||
sign = -1;
|
||||
|
||||
int sign = t.rot->mirror ? -1 : 1;
|
||||
txt->SetMirrored( t.rot->mirror );
|
||||
|
||||
double degrees = t.rot->degrees;
|
||||
|
||||
if( degrees == 90 || t.rot->spin )
|
||||
txt->SetOrientation( sign * degrees * 10 );
|
||||
|
||||
else if( degrees == 180 )
|
||||
align = ETEXT::TOP_RIGHT;
|
||||
|
||||
else if( degrees == 270 )
|
||||
{
|
||||
align = ETEXT::TOP_RIGHT;
|
||||
txt->SetOrientation( sign * 90 * 10 );
|
||||
}
|
||||
}
|
||||
|
||||
int align = t.align ? *t.align : ETEXT::BOTTOM_LEFT; // bottom-left is eagle default
|
||||
|
||||
switch( align * sign ) // when negative, opposites are chosen
|
||||
switch( align )
|
||||
{
|
||||
case ETEXT::CENTER:
|
||||
// this was the default in pcbtxt's constructor
|
||||
|
@ -1995,7 +2198,11 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, CPTREE& aTree ) const
|
|||
pad->SetSize( wxSize( kicad( e.dx ), kicad( e.dy ) ) );
|
||||
|
||||
pad->SetLayer( layer );
|
||||
pad->SetLayerMask( LAYER_FRONT | SOLDERPASTE_LAYER_FRONT | SOLDERMASK_LAYER_FRONT );
|
||||
|
||||
if( layer == LAYER_N_FRONT )
|
||||
pad->SetLayerMask( LAYER_FRONT | SOLDERPASTE_LAYER_FRONT | SOLDERMASK_LAYER_FRONT );
|
||||
else if( layer == LAYER_N_BACK )
|
||||
pad->SetLayerMask( LAYER_BACK | SOLDERPASTE_LAYER_BACK | SOLDERMASK_LAYER_BACK );
|
||||
|
||||
// Optional according to DTD
|
||||
if( e.roundness ) // set set shape to PAD_RECT above, in case roundness is not present
|
||||
|
@ -2082,8 +2289,6 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
|
|||
|
||||
via->SetLayerPair( layer_front_most, layer_back_most );
|
||||
|
||||
// via diameters are externally controllable, not usually in a board:
|
||||
// http://www.eaglecentral.ca/forums/index.php/mv/msg/34704/119478/
|
||||
if( v.diam )
|
||||
{
|
||||
int kidiam = kicad( *v.diam );
|
||||
|
@ -2091,7 +2296,9 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
|
|||
}
|
||||
else
|
||||
{
|
||||
int diameter = std::max( drillz + 2 * Mils2iu( 6 ), int( drillz * 2.0 ) );
|
||||
double annulus = drillz * m_rules->rvViaOuter; // eagle "restring"
|
||||
annulus = Clamp( m_rules->rlMinViaOuter, annulus, m_rules->rlMaxViaOuter );
|
||||
int diameter = KiROUND( drillz + 2 * annulus );
|
||||
via->SetWidth( diameter );
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,12 @@ typedef NET_MAP::const_iterator NET_MAP_CITER;
|
|||
typedef boost::property_tree::ptree PTREE;
|
||||
typedef const PTREE CPTREE;
|
||||
|
||||
class EELEMENT;
|
||||
class XPATH;
|
||||
struct ERULES;
|
||||
struct EATTR;
|
||||
class TEXTE_MODULE;
|
||||
|
||||
|
||||
/**
|
||||
* Class EAGLE_PLUGIN
|
||||
|
@ -107,6 +112,7 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
ERULES* m_rules; ///< Eagle design rules.
|
||||
XPATH* m_xpath; ///< keeps track of what we are working on within
|
||||
///< XML document during a Load().
|
||||
|
||||
|
@ -173,12 +179,17 @@ private:
|
|||
// all these loadXXX() throw IO_ERROR or ptree_error exceptions:
|
||||
|
||||
void loadAllSections( CPTREE& aDocument );
|
||||
void loadDesignRules( CPTREE& aDesignRules );
|
||||
void loadLayerDefs( CPTREE& aLayers );
|
||||
void loadPlain( CPTREE& aPlain );
|
||||
void loadSignals( CPTREE& aSignals );
|
||||
void loadLibraries( CPTREE& aLibs );
|
||||
void loadElements( CPTREE& aElements );
|
||||
|
||||
void orientModuleAndText( MODULE* m, const EELEMENT& e, const EATTR* nameAttr, const EATTR* valueAttr );
|
||||
void orientModuleText( MODULE* m, const EELEMENT& e, TEXTE_MODULE* txt, const EATTR* a );
|
||||
|
||||
|
||||
/// move the BOARD into the center of the page
|
||||
void centerBoard();
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
@ -467,6 +468,13 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
SetCurItem( NULL ); // Outlines can have changed
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_ZONE_DUPLICATE:
|
||||
{
|
||||
ZONE_CONTAINER* zone = (ZONE_CONTAINER*) GetCurItem();
|
||||
duplicateZone( &dc, zone );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE:
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
m_canvas->SetAutoPanRequest( true );
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2012 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
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#include <fctsys.h>
|
||||
#include <confirm.h>
|
||||
#include <kicad_string.h>
|
||||
#include <gestfich.h>
|
||||
#include <wxPcbStruct.h>
|
||||
#include <drawtxt.h>
|
||||
#include <trigo.h>
|
||||
|
@ -21,6 +19,8 @@
|
|||
#include <cmath>
|
||||
|
||||
|
||||
#define SEGM_COUNT_PER_360 32 // Number of segments to approximate a circle per segments
|
||||
|
||||
/* helper function:
|
||||
* some characters cannot be used in names,
|
||||
* this function change them to "_"
|
||||
|
@ -43,8 +43,9 @@ private:
|
|||
wxConfig* m_config;
|
||||
int m_unitsOpt; // to remember last option
|
||||
int m_3DFilesOpt; // to remember last option
|
||||
virtual void OnCancelClick( wxCommandEvent& event ){ EndModal( wxID_CANCEL ); }
|
||||
virtual void OnOkClick( wxCommandEvent& event ){ EndModal( wxID_OK ); }
|
||||
|
||||
void OnCancelClick( wxCommandEvent& event ){ EndModal( wxID_CANCEL ); }
|
||||
void OnOkClick( wxCommandEvent& event ){ EndModal( wxID_OK ); }
|
||||
|
||||
public:
|
||||
DIALOG_EXPORT_3DFILE( PCB_EDIT_FRAME* parent ) :
|
||||
|
@ -104,8 +105,9 @@ struct VRMLPt
|
|||
};
|
||||
struct FlatPt
|
||||
{
|
||||
FlatPt( double _x = 0, double _y = 0 ) : x( _x ), y( _y ) { }
|
||||
double x, y;
|
||||
FlatPt( double _x = 0, double _y = 0 ) : x( _x ), y( _y )
|
||||
{ }
|
||||
double x, y;
|
||||
};
|
||||
struct Triangle
|
||||
{
|
||||
|
@ -277,7 +279,7 @@ static void write_triangle_bag( FILE* output_file, int color_index, //{{{
|
|||
" }\n",
|
||||
" }\n",
|
||||
" geometry IndexedFaceSet {\n",
|
||||
" solid true\n",
|
||||
" solid TRUE\n",
|
||||
" coord Coordinate {\n",
|
||||
" point [\n",
|
||||
0, // Coordinates marker
|
||||
|
@ -369,7 +371,7 @@ static void compute_layer_Zs( BOARD* pcb ) //{{{
|
|||
int copper_layers = pcb->GetCopperLayerCount( );
|
||||
|
||||
// We call it 'layer' thickness, but it's the whole board thickness!
|
||||
double board_thickness = pcb->GetDesignSettings().m_BoardThickness;
|
||||
double board_thickness = pcb->GetDesignSettings().GetBoardThickness();
|
||||
double half_thickness = board_thickness / 2;
|
||||
|
||||
// Compute each layer's Z value, more or less like the 3d view
|
||||
|
@ -383,7 +385,7 @@ static void compute_layer_Zs( BOARD* pcb ) //{{{
|
|||
|
||||
/* To avoid rounding interference, we apply an epsilon to each
|
||||
* successive layer */
|
||||
const double epsilon_z = 10; // That's 1 mils, about 1/50 mm
|
||||
const double epsilon_z = 1 * IU_PER_MILS; // That's 1 mils, about 1/50 mm
|
||||
layer_z[SOLDERPASTE_N_BACK] = -half_thickness - epsilon_z * 4;
|
||||
layer_z[ADHESIVE_N_BACK] = -half_thickness - epsilon_z * 3;
|
||||
layer_z[SILKSCREEN_N_BACK] = -half_thickness - epsilon_z * 2;
|
||||
|
@ -429,8 +431,8 @@ static void export_vrml_line( int layer, double startx, double starty, //{{{
|
|||
}
|
||||
|
||||
|
||||
static void export_vrml_circle( int layer, double startx, double starty, //{{{
|
||||
double endx, double endy, double width, int divisions )
|
||||
static void export_vrml_circle( int layer, double startx, double starty,
|
||||
double endx, double endy, double width )
|
||||
{
|
||||
double hole, radius;
|
||||
FlatRing ring;
|
||||
|
@ -438,7 +440,7 @@ static void export_vrml_circle( int layer, double startx, double starty, //{{{
|
|||
radius = hypot( startx - endx, starty - endy ) + ( width / 2);
|
||||
hole = radius - width;
|
||||
|
||||
for( double alpha = 0; alpha < M_PI * 2; alpha += M_PI * 2 / divisions )
|
||||
for( double alpha = 0; alpha < M_PI * 2; alpha += M_PI * 2 / SEGM_COUNT_PER_360 )
|
||||
{
|
||||
ring.add_inner( startx + hole * cos( alpha ), starty + hole * sin( alpha ) );
|
||||
ring.add_outer( startx + radius * cos( alpha ), starty + radius * sin( alpha ) );
|
||||
|
@ -450,10 +452,11 @@ static void export_vrml_circle( int layer, double startx, double starty, //{{{
|
|||
|
||||
static void export_vrml_slot( TriangleBag& triangles, //{{{
|
||||
int top_layer, int bottom_layer, double xc, double yc,
|
||||
double dx, double dy, int orient, int divisions )
|
||||
double dx, double dy, int orient )
|
||||
{
|
||||
double capx, capy; // Cap center
|
||||
VLoop loop;
|
||||
int divisions = SEGM_COUNT_PER_360 / 2;
|
||||
|
||||
loop.z_top = layer_z[top_layer];
|
||||
loop.z_bottom = layer_z[bottom_layer];
|
||||
|
@ -491,45 +494,23 @@ static void export_vrml_slot( TriangleBag& triangles, //{{{
|
|||
}
|
||||
|
||||
|
||||
static void export_vrml_hole( TriangleBag& triangles, //{{{
|
||||
int top_layer, int bottom_layer, double xc, double yc, double hole,
|
||||
int divisions )
|
||||
static void export_vrml_hole( TriangleBag& triangles, int top_layer, int bottom_layer,
|
||||
double xc, double yc, double hole )
|
||||
{
|
||||
VLoop loop;
|
||||
|
||||
loop.z_top = layer_z[top_layer];
|
||||
loop.z_bottom = layer_z[bottom_layer];
|
||||
|
||||
for( double alpha = 0; alpha < M_PI * 2; alpha += M_PI * 2 / divisions )
|
||||
for( double alpha = 0; alpha < M_PI * 2; alpha += M_PI * 2 / SEGM_COUNT_PER_360 )
|
||||
loop.add( xc + cos( alpha ) * hole, yc + sin( alpha ) * hole );
|
||||
|
||||
loop.bag( triangles );
|
||||
}
|
||||
|
||||
|
||||
static void export_vrml_varc( TriangleBag& triangles, //{{{
|
||||
int top_layer, int bottom_layer, double startx, double starty,
|
||||
double endx, double endy, int divisions )
|
||||
{
|
||||
VLoop loop;
|
||||
|
||||
loop.z_top = layer_z[top_layer];
|
||||
loop.z_bottom = layer_z[bottom_layer];
|
||||
double angle = atan2( endx - startx, endy - starty );
|
||||
double radius = hypot( startx - endx, starty - endy );
|
||||
|
||||
for( double alpha = angle; alpha < angle + PI2; alpha += PI2 / divisions )
|
||||
{
|
||||
loop.add( startx + cos( alpha ) * radius, starty + sin( alpha ) * radius );
|
||||
}
|
||||
|
||||
loop.bag( triangles );
|
||||
}
|
||||
|
||||
|
||||
static void export_vrml_oval_pad( int layer, //{{{
|
||||
double xc, double yc,
|
||||
double dx, double dy, int orient, int divisions )
|
||||
static void export_vrml_oval_pad( int layer, double xc, double yc,
|
||||
double dx, double dy, int orient )
|
||||
{
|
||||
double capx, capy; // Cap center
|
||||
FlatFan fan;
|
||||
|
@ -537,6 +518,7 @@ static void export_vrml_oval_pad( int layer, //{{{
|
|||
fan.c.x = xc;
|
||||
fan.c.y = yc;
|
||||
double angle = orient / 1800.0 * M_PI;
|
||||
int divisions = SEGM_COUNT_PER_360 / 2;
|
||||
|
||||
if( dy > dx )
|
||||
{
|
||||
|
@ -570,25 +552,68 @@ static void export_vrml_oval_pad( int layer, //{{{
|
|||
}
|
||||
|
||||
|
||||
static void export_vrml_arc( int layer, double startx, double starty, //{{{
|
||||
double endx, double endy, double width, int divisions )
|
||||
static void export_vrml_arc( int layer, double centerx, double centery,
|
||||
double arc_startx, double arc_starty,
|
||||
double width, double arc_angle )
|
||||
{
|
||||
FlatRing ring;
|
||||
double hole, radius;
|
||||
double angle = atan2( endx - startx, endy - starty );
|
||||
double start_angle = atan2( arc_starty - centery, arc_startx - centerx );
|
||||
|
||||
radius = hypot( startx - endx, starty - endy ) + ( width / 2);
|
||||
hole = radius - width;
|
||||
int count = KiROUND( arc_angle / 360.0 * SEGM_COUNT_PER_360 );
|
||||
if( count < 0 )
|
||||
count = -count;
|
||||
if( count == 0 )
|
||||
count = 1;
|
||||
double divisions = arc_angle*M_PI/180.0 / count;
|
||||
|
||||
for( double alpha = angle; alpha < angle + PI2; alpha += PI2 / divisions )
|
||||
double outer_radius = hypot( arc_starty - centery, arc_startx - centerx )
|
||||
+ ( width / 2);
|
||||
double inner_radius = outer_radius - width;
|
||||
|
||||
double alpha = 0;
|
||||
for( int ii = 0; ii <= count; alpha += divisions, ii++ )
|
||||
{
|
||||
ring.add_inner( startx + cos( alpha ) * hole, starty + sin( alpha ) * hole );
|
||||
ring.add_outer( startx + cos( alpha ) * radius, starty + sin( alpha ) * radius );
|
||||
double angle_rot = start_angle + alpha;
|
||||
ring.add_inner( centerx + cos( angle_rot ) * inner_radius,
|
||||
centery + sin( angle_rot ) * inner_radius );
|
||||
ring.add_outer( centerx + cos( angle_rot ) * outer_radius,
|
||||
centery + sin( angle_rot ) * outer_radius );
|
||||
}
|
||||
|
||||
ring.bag( layer, false );
|
||||
}
|
||||
|
||||
static void export_vrml_varc( TriangleBag& triangles,
|
||||
int top_layer, int bottom_layer,
|
||||
double centerx, double centery,
|
||||
double arc_startx, double arc_starty,
|
||||
double arc_angle )
|
||||
{
|
||||
VLoop loop;
|
||||
|
||||
loop.z_top = layer_z[top_layer];
|
||||
loop.z_bottom = layer_z[bottom_layer];
|
||||
|
||||
double start_angle = atan2( arc_starty - centery, arc_startx - centerx );
|
||||
double radius = hypot( arc_starty - centery, arc_startx - centerx );
|
||||
|
||||
int count = KiROUND( arc_angle / 360.0 * SEGM_COUNT_PER_360 );
|
||||
if( count < 0 )
|
||||
count = -count;
|
||||
if( count == 0 )
|
||||
count = 1;
|
||||
double divisions = arc_angle*M_PI/180.0 / count;
|
||||
|
||||
double alpha = 0;
|
||||
for( int ii = 0; ii <= count; alpha += divisions, ii++ )
|
||||
{
|
||||
double angle_rot = start_angle + alpha;
|
||||
loop.add( centerx + cos( angle_rot ) * radius, centery + sin( angle_rot ) * radius );
|
||||
}
|
||||
|
||||
loop.bag( triangles );
|
||||
}
|
||||
|
||||
|
||||
static void export_vrml_drawsegment( DRAWSEGMENT* drawseg ) //{{{
|
||||
{
|
||||
|
@ -608,14 +633,14 @@ static void export_vrml_drawsegment( DRAWSEGMENT* drawseg ) //{{{
|
|||
case S_ARC:
|
||||
export_vrml_varc( layer_triangles[layer],
|
||||
FIRST_COPPER_LAYER, LAST_COPPER_LAYER,
|
||||
x, y, xf, yf, 4 );
|
||||
x, y, xf, yf, drawseg->GetAngle()/10 );
|
||||
break;
|
||||
|
||||
// Circles on edge are usually important holes
|
||||
case S_CIRCLE:
|
||||
export_vrml_hole( layer_triangles[layer],
|
||||
FIRST_COPPER_LAYER, LAST_COPPER_LAYER, x, y,
|
||||
hypot( xf - x, yf - y ) / 2, 12 );
|
||||
hypot( xf - x, yf - y ) / 2 );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -633,11 +658,16 @@ static void export_vrml_drawsegment( DRAWSEGMENT* drawseg ) //{{{
|
|||
switch( drawseg->GetShape() )
|
||||
{
|
||||
case S_ARC:
|
||||
export_vrml_arc( layer, x, y, xf, yf, w, 3 );
|
||||
export_vrml_arc( layer,
|
||||
(double) drawseg->GetCenter().x,
|
||||
(double) drawseg->GetCenter().y,
|
||||
(double) drawseg->GetArcStart().x,
|
||||
(double) drawseg->GetArcStart().y,
|
||||
w, drawseg->GetAngle()/10 );
|
||||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
export_vrml_circle( layer, x, y, xf, yf, w, 12 );
|
||||
export_vrml_circle( layer, x, y, xf, yf, w );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -727,7 +757,7 @@ static void export_vrml_drawings( BOARD* pcb ) //{{{
|
|||
|
||||
|
||||
static void export_round_padstack( BOARD* pcb, double x, double y, double r, //{{{
|
||||
int bottom_layer, int top_layer, int divisions )
|
||||
int bottom_layer, int top_layer )
|
||||
{
|
||||
int copper_layers = pcb->GetCopperLayerCount( );
|
||||
|
||||
|
@ -738,7 +768,7 @@ static void export_round_padstack( BOARD* pcb, double x, double y, double r, //{
|
|||
layer = LAST_COPPER_LAYER;
|
||||
|
||||
if( layer <= top_layer )
|
||||
export_vrml_circle( layer, x, y, x + r / 2, y, r, divisions );
|
||||
export_vrml_circle( layer, x, y, x + r / 2, y, r );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -755,10 +785,10 @@ static void export_vrml_via( BOARD* pcb, SEGVIA* via ) //{{{
|
|||
via->ReturnLayerPair( &top_layer, &bottom_layer );
|
||||
|
||||
// Export the via padstack
|
||||
export_round_padstack( pcb, x, y, r, bottom_layer, top_layer, 8 );
|
||||
export_round_padstack( pcb, x, y, r, bottom_layer, top_layer );
|
||||
|
||||
// Drill a rough hole
|
||||
export_vrml_hole( via_triangles[via->m_Shape], top_layer, bottom_layer, x, y, hole, 8 );
|
||||
// Drill a hole
|
||||
export_vrml_hole( via_triangles[via->m_Shape], top_layer, bottom_layer, x, y, hole );
|
||||
}
|
||||
|
||||
|
||||
|
@ -853,23 +883,23 @@ static void export_vrml_text_module( TEXTE_MODULE* module ) //{{{
|
|||
}
|
||||
|
||||
|
||||
static void export_vrml_edge_module( EDGE_MODULE* module ) //{{{
|
||||
static void export_vrml_edge_module( EDGE_MODULE* aOutline ) //{{{
|
||||
{
|
||||
int layer = module->GetLayer();
|
||||
double x = module->GetStart().x;
|
||||
double y = module->GetStart().y;
|
||||
double xf = module->GetEnd().x;
|
||||
double yf = module->GetEnd().y;
|
||||
double w = module->GetWidth();
|
||||
int layer = aOutline->GetLayer();
|
||||
double x = aOutline->GetStart().x;
|
||||
double y = aOutline->GetStart().y;
|
||||
double xf = aOutline->GetEnd().x;
|
||||
double yf = aOutline->GetEnd().y;
|
||||
double w = aOutline->GetWidth();
|
||||
|
||||
switch( module->GetShape() )
|
||||
switch( aOutline->GetShape() )
|
||||
{
|
||||
case S_ARC:
|
||||
export_vrml_arc( layer, x, y, xf, yf, w, 3 );
|
||||
export_vrml_arc( layer, x, y, xf, yf, w, aOutline->GetAngle()/10 );
|
||||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
export_vrml_circle( layer, x, y, xf, yf, w, 12 );
|
||||
export_vrml_circle( layer, x, y, xf, yf, w );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -895,14 +925,14 @@ static void export_vrml_pad( BOARD* pcb, D_PAD* aPad ) //{{{
|
|||
// Oblong hole (slot)
|
||||
export_vrml_slot( layer_triangles[EDGE_N],
|
||||
FIRST_COPPER_LAYER, LAST_COPPER_LAYER,
|
||||
hole_x, hole_y, hole_drill_w, hole_drill_h, aPad->GetOrientation(), 6 );
|
||||
hole_x, hole_y, hole_drill_w, hole_drill_h, aPad->GetOrientation() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Drill a round hole
|
||||
export_vrml_hole( layer_triangles[EDGE_N],
|
||||
FIRST_COPPER_LAYER, LAST_COPPER_LAYER,
|
||||
hole_x, hole_y, hole_drill, 12 );
|
||||
hole_x, hole_y, hole_drill );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -935,13 +965,12 @@ static void export_vrml_pad( BOARD* pcb, D_PAD* aPad ) //{{{
|
|||
{
|
||||
case PAD_CIRCLE:
|
||||
export_vrml_circle( layer, pad_x, pad_y,
|
||||
pad_x + pad_w / 2, pad_y, pad_w, 12 );
|
||||
pad_x + pad_w / 2, pad_y, pad_w );
|
||||
break;
|
||||
|
||||
case PAD_OVAL:
|
||||
export_vrml_oval_pad( layer,
|
||||
pad_x, pad_y,
|
||||
pad_w * 2, pad_h * 2, aPad->GetOrientation(), 4 );
|
||||
export_vrml_oval_pad( layer, pad_x, pad_y,
|
||||
pad_w * 2, pad_h * 2, aPad->GetOrientation() );
|
||||
break;
|
||||
|
||||
case PAD_RECT:
|
||||
|
@ -1192,7 +1221,7 @@ wxBusyCursor dummy;
|
|||
if( ! ExportVRML_File( fullFilename, scale, export3DFiles, subDirFor3Dshapes ) )
|
||||
{
|
||||
wxString msg = _( "Unable to create " ) + fullFilename;
|
||||
DisplayError( this, msg );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue