merge 1 with tip

This commit is contained in:
Miguel Angel Ajo 2012-06-03 22:06:51 +02:00
commit 30e251bfba
2738 changed files with 437498 additions and 307125 deletions

View File

@ -21,6 +21,8 @@ common/pcb_plot_params_keywords.cpp
include/pcb_plot_params_lexer.h
pcbnew/specctra_keywords.cpp
pcbnew/specctra_lexer.h
pcb_calculator/pcb_calculator_datafile_keywords.cpp
pcb_calculator/pcb_calculator_datafile_lexer.h
new/html
new/sch_lib_table_keywords.cpp
new/sch_lib_table_lexer.h

View File

@ -35,9 +35,9 @@
/* 3D modeling units -> PCB units conversion scale:
* 1 "3D model unit" wings3d = 1 unit = 2.54 mm = 0.1 inch
* 1 "3D model unit" wings3d = 1 unit = 2.54 mm = 0.1 inch = 100 mils
*/
#define UNITS3D_TO_UNITSPCB 1000
#define UNITS3D_TO_UNITSPCB (IU_PER_MILS * 100)
class S3D_MASTER;

View File

@ -4,6 +4,14 @@ KiCad ChangeLog 2012
Please add newer entries at the top, list the date and your name with
email address.
2012-May-5 UPDATE Jerry Jacobs <jerry@xor-gate.org>
================================================================================
++ common
* Update about dialog to more native size so the notebook is not squeezed
* Increment copyright year to 2012
* Fix mousezoom jumping to center for Mac OS X and other platforms
* Remove lowercase application name because Mac OS X menubar was inconsitent
2012-Mar-11 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew

View File

@ -278,7 +278,7 @@ add_subdirectory(polygon/kbool/src)
add_subdirectory(potrace)
add_subdirectory(bitmap2component)
add_subdirectory(pcb_calculator)
#add_subdirectory(tools)
add_subdirectory(tools)
#add_subdirectory(new)

View File

@ -413,6 +413,7 @@ set( BMAPS_MID
pin_to
pin
plot_hpg
plot_pdf
plot_ps
plot
polar_coord

View File

@ -0,0 +1,96 @@
/* 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, 0x04, 0xf5, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xad, 0x96, 0x6d, 0x4c, 0x53,
0x57, 0x18, 0xc7, 0x99, 0x31, 0xc3, 0x39, 0x60, 0xd9, 0x3e, 0xcc, 0x4f, 0xc6, 0xcc, 0x4f, 0xcb,
0x0c, 0x7c, 0x11, 0x26, 0x03, 0x17, 0xb6, 0x25, 0x3a, 0xd1, 0x31, 0x62, 0x06, 0x73, 0x46, 0x64,
0xb0, 0x4c, 0xe7, 0x46, 0x47, 0x41, 0x29, 0xef, 0xb4, 0xbc, 0x96, 0x81, 0x03, 0x9d, 0x10, 0x44,
0x88, 0x56, 0x5e, 0x94, 0xa9, 0x0c, 0x3a, 0x5e, 0x0a, 0x13, 0x10, 0x0b, 0x85, 0x19, 0xc3, 0x5a,
0xa5, 0x50, 0x6a, 0xa1, 0xaf, 0x40, 0xa1, 0xa5, 0x16, 0x0a, 0x05, 0x24, 0x0a, 0xff, 0x9d, 0x7b,
0xa1, 0x8d, 0x82, 0x46, 0xd6, 0xf9, 0x24, 0xbf, 0xf4, 0xf6, 0x9c, 0xdc, 0xff, 0xff, 0x9c, 0xe7,
0x3c, 0xf7, 0xb9, 0xd7, 0x09, 0x80, 0xd3, 0x7a, 0x88, 0x89, 0x8b, 0xd9, 0xd3, 0xf3, 0x4f, 0x8f,
0xe0, 0xd7, 0xfc, 0x9c, 0xa8, 0x5f, 0x72, 0xb3, 0x4e, 0x66, 0x9f, 0xe6, 0xc6, 0x92, 0xdf, 0xc4,
0xce, 0x4e, 0x61, 0xf5, 0x29, 0xd6, 0x29, 0xd6, 0xcb, 0xee, 0x77, 0x5a, 0xaf, 0x11, 0x2b, 0x81,
0x95, 0xd0, 0xd5, 0x2d, 0xba, 0x42, 0xc4, 0xe3, 0x13, 0x53, 0xe2, 0xf3, 0x62, 0x13, 0x62, 0x0b,
0xc8, 0x75, 0x66, 0x75, 0xf5, 0xf5, 0x4b, 0x69, 0x19, 0x69, 0xe7, 0x5f, 0x99, 0x11, 0x27, 0x9d,
0x53, 0xd0, 0x7c, 0x53, 0x70, 0x89, 0x88, 0xa7, 0x1f, 0x0d, 0x0f, 0xcb, 0xff, 0x26, 0xe4, 0x48,
0x7a, 0x26, 0x37, 0xe3, 0x37, 0xde, 0xe5, 0x52, 0x5e, 0x66, 0x36, 0xb7, 0xca, 0x61, 0xa3, 0xd4,
0xd4, 0xd4, 0x4d, 0xb5, 0xfc, 0x1b, 0x0d, 0xed, 0xb7, 0xdb, 0xc4, 0xb7, 0xda, 0xdb, 0xc4, 0x8d,
0x4d, 0x0d, 0x13, 0xad, 0xb7, 0x5a, 0xcc, 0xcd, 0x7f, 0x09, 0x0c, 0x75, 0x0d, 0x75, 0x63, 0x8d,
0x82, 0x7a, 0x0d, 0xc1, 0x44, 0xfe, 0x9b, 0xeb, 0x1b, 0xeb, 0x26, 0x5b, 0xdb, 0x5a, 0xc4, 0x14,
0xfc, 0xfa, 0x1a, 0x51, 0x56, 0x56, 0xd6, 0x96, 0x75, 0x1b, 0x5d, 0x28, 0x39, 0x9f, 0x3f, 0x3b,
0x37, 0xbb, 0x34, 0x3b, 0x6b, 0x85, 0xd5, 0x3a, 0x83, 0x99, 0x99, 0x69, 0x4c, 0xcf, 0x58, 0x60,
0x99, 0x26, 0x58, 0xa6, 0x30, 0x65, 0x99, 0xc4, 0xe4, 0x94, 0x19, 0xe6, 0xc9, 0x87, 0x78, 0x68,
0x26, 0x3c, 0x9c, 0x80, 0x89, 0x30, 0x4d, 0xe6, 0xab, 0xae, 0x55, 0xb6, 0xbe, 0xd4, 0x88, 0xa4,
0xe6, 0x35, 0xc2, 0xa6, 0x0b, 0xa5, 0xc5, 0xbc, 0xb9, 0xb9, 0x59, 0xfa, 0xe6, 0x89, 0x09, 0x03,
0x0c, 0xc6, 0x71, 0x8c, 0x1b, 0xc6, 0x30, 0x36, 0xae, 0x87, 0x7e, 0x6c, 0x04, 0xa3, 0xfa, 0x61,
0x0c, 0x8f, 0xea, 0xa0, 0x1b, 0xd1, 0x42, 0xab, 0x53, 0x43, 0xa3, 0x55, 0x41, 0xad, 0x51, 0x62,
0xc2, 0x64, 0x44, 0x0d, 0xff, 0x86, 0x88, 0xd2, 0x20, 0x6c, 0x78, 0xae, 0x11, 0x35, 0x71, 0xb5,
0xaa, 0xa2, 0x43, 0xa1, 0x90, 0x5b, 0xce, 0x16, 0x9c, 0x7d, 0x62, 0x30, 0x8c, 0x43, 0xa9, 0x1a,
0xc2, 0x90, 0x52, 0x01, 0xc5, 0xd0, 0x03, 0x3c, 0x50, 0xc8, 0x21, 0x7f, 0x30, 0x80, 0x01, 0xb9,
0x0c, 0xb2, 0x81, 0x7e, 0xc8, 0x64, 0x7d, 0xe8, 0x93, 0x49, 0x21, 0xed, 0xbf, 0x8f, 0x5e, 0xe9,
0x3d, 0xdc, 0xef, 0x95, 0x40, 0xa5, 0x56, 0xe2, 0xd2, 0xe5, 0x8b, 0x8b, 0x7d, 0xfd, 0x52, 0x0b,
0xff, 0xcf, 0x9a, 0x7e, 0xa2, 0xf9, 0xe6, 0x1a, 0xa3, 0x8b, 0xbc, 0xd2, 0xc2, 0xa9, 0xa9, 0xc9,
0x27, 0x46, 0xb2, 0xfa, 0xef, 0x4e, 0x1c, 0x47, 0x54, 0x4c, 0x0c, 0x58, 0x09, 0x09, 0x88, 0xa5,
0x48, 0xa4, 0x48, 0x44, 0x9c, 0x8d, 0xa4, 0x24, 0x9a, 0x78, 0x1b, 0xc9, 0xc9, 0x48, 0x48, 0x49,
0x26, 0xd7, 0xc9, 0x88, 0x60, 0x46, 0xa2, 0xab, 0xbb, 0x9b, 0x4e, 0x39, 0x59, 0x78, 0xcb, 0x33,
0x46, 0xe4, 0xf9, 0x70, 0x1f, 0x1a, 0x52, 0x58, 0x2c, 0x24, 0xf7, 0x54, 0x8a, 0xc2, 0x8f, 0x1d,
0x43, 0x4a, 0x1a, 0x7b, 0x5d, 0xb0, 0xd3, 0x38, 0xcb, 0xa4, 0xb3, 0x41, 0xaa, 0x13, 0x27, 0x18,
0x0c, 0x88, 0xba, 0x44, 0x98, 0x24, 0xe7, 0x67, 0x30, 0x1a, 0x16, 0xce, 0x15, 0x9e, 0x39, 0x6a,
0x37, 0xaa, 0xe5, 0xff, 0x21, 0xa1, 0x56, 0x60, 0x36, 0x9b, 0x68, 0xa3, 0x43, 0x21, 0x21, 0xf8,
0xfe, 0xc7, 0x1f, 0x1c, 0xe2, 0xeb, 0x90, 0x23, 0xb4, 0x11, 0xa5, 0x65, 0xb5, 0x4e, 0x43, 0x28,
0x6c, 0xd7, 0xd0, 0x26, 0xe9, 0x99, 0x1c, 0x57, 0xb9, 0x5c, 0x66, 0x36, 0x91, 0x83, 0xa4, 0x0e,
0x7e, 0x54, 0x3f, 0x82, 0x80, 0xaf, 0x82, 0x70, 0xe0, 0xe0, 0x41, 0x87, 0xf8, 0x3c, 0x20, 0x00,
0xc2, 0x8e, 0x0e, 0x5a, 0x8b, 0x62, 0x78, 0x44, 0xf7, 0x68, 0xf9, 0x99, 0x49, 0x4f, 0xf1, 0xd6,
0x68, 0xd5, 0x0b, 0xc3, 0xa3, 0x1a, 0x50, 0xa8, 0x34, 0x83, 0xf8, 0x74, 0xef, 0x3e, 0xec, 0xf4,
0xf6, 0x71, 0x08, 0xef, 0x8f, 0xfd, 0xd0, 0xda, 0xde, 0x0a, 0x9b, 0xde, 0xb8, 0x41, 0xbf, 0x9c,
0xb6, 0x9c, 0xd3, 0xdc, 0x13, 0x54, 0xa9, 0x0e, 0xaa, 0xe4, 0x76, 0xf2, 0xce, 0x9d, 0x41, 0x3c,
0x3b, 0xd9, 0x21, 0xd2, 0xb2, 0xb3, 0x30, 0xa0, 0xe8, 0x83, 0xa4, 0xef, 0x6f, 0xdc, 0x95, 0xdc,
0x86, 0xd1, 0x64, 0xb0, 0x97, 0x35, 0x53, 0xa5, 0x55, 0x42, 0x3a, 0x20, 0x79, 0xa5, 0x88, 0xfb,
0x85, 0xb8, 0x2b, 0x6d, 0xc1, 0xc8, 0x98, 0x6e, 0xd9, 0x28, 0x2b, 0x3b, 0x83, 0xa9, 0x1b, 0xd1,
0x40, 0xad, 0x1b, 0xa2, 0x91, 0x29, 0xa4, 0x68, 0x6e, 0x69, 0x44, 0xd3, 0xcd, 0x06, 0x87, 0x91,
0xf4, 0xf6, 0x40, 0x33, 0xac, 0x84, 0x76, 0x58, 0x45, 0x76, 0x34, 0x8e, 0x95, 0x62, 0x48, 0xfd,
0x8c, 0xc1, 0x8c, 0x98, 0x8a, 0x8c, 0x8e, 0xb4, 0x32, 0x4f, 0x32, 0x67, 0x23, 0xa3, 0x19, 0x8b,
0xe5, 0x95, 0x65, 0xb8, 0x76, 0xfd, 0x0a, 0xae, 0xfe, 0x5e, 0xfe, 0x9f, 0xe1, 0xd7, 0xd5, 0xe2,
0xa7, 0x9f, 0x8f, 0x2f, 0x45, 0x9f, 0x8a, 0x9a, 0xa3, 0x34, 0x19, 0x91, 0x11, 0x56, 0x7b, 0x79,
0xef, 0xf5, 0xdf, 0x77, 0xef, 0x40, 0x60, 0x00, 0xbe, 0x0d, 0x0f, 0xa3, 0x3b, 0x00, 0x79, 0xa0,
0xe8, 0xfe, 0xe6, 0x08, 0x56, 0xab, 0x15, 0xd9, 0x39, 0x19, 0x08, 0x3a, 0x14, 0x0c, 0xff, 0x80,
0x03, 0x84, 0x2f, 0xd4, 0x76, 0xa3, 0x9d, 0x1f, 0xf9, 0xd4, 0x7b, 0xf9, 0xee, 0x5e, 0xfc, 0xc0,
0xdd, 0x1d, 0x4c, 0x26, 0x13, 0x51, 0x51, 0x51, 0x60, 0xb3, 0xd9, 0xe8, 0xed, 0xed, 0x05, 0x15,
0x6d, 0x6d, 0x6d, 0xf6, 0xf1, 0x24, 0xd2, 0x09, 0x9a, 0x9a, 0x9a, 0x60, 0x0b, 0xdb, 0xdc, 0xd3,
0x94, 0x57, 0xf0, 0xb0, 0x3f, 0xf0, 0x4b, 0x78, 0xf9, 0xec, 0x86, 0xa7, 0x8f, 0xaf, 0xd8, 0x6e,
0xb4, 0x63, 0xc7, 0x27, 0x2e, 0xee, 0x9e, 0xbb, 0x22, 0x36, 0x6f, 0xde, 0xfc, 0x48, 0x20, 0x10,
0xd0, 0x42, 0x3c, 0x1e, 0x0f, 0x5b, 0xb7, 0x6e, 0x85, 0x56, 0xab, 0x45, 0x6e, 0x6e, 0x2e, 0x8e,
0x91, 0x6e, 0x41, 0x8d, 0x57, 0x55, 0x55, 0xc1, 0xd7, 0xd7, 0x97, 0x1e, 0xa3, 0x22, 0x27, 0x27,
0x07, 0x61, 0x61, 0x61, 0xf4, 0x9c, 0x8d, 0xdb, 0x1d, 0xb7, 0x10, 0x97, 0x1c, 0xd3, 0xef, 0xe1,
0xf9, 0x21, 0xcb, 0xc3, 0xc3, 0xe7, 0xdd, 0x67, 0x7a, 0x5d, 0x74, 0x74, 0xf4, 0x1b, 0x6e, 0x6f,
0xb9, 0x3d, 0x5e, 0x5c, 0x5c, 0xb4, 0xaf, 0x36, 0x28, 0x28, 0x08, 0xcd, 0xcd, 0xcd, 0xb4, 0x68,
0x5e, 0x5e, 0x9e, 0x7d, 0x9c, 0x4a, 0x8f, 0x9b, 0x9b, 0x1b, 0x16, 0x16, 0x16, 0x68, 0x23, 0x2e,
0x97, 0x8b, 0xa7, 0x63, 0x50, 0x29, 0x47, 0x45, 0x65, 0x99, 0x86, 0x11, 0xc3, 0x78, 0x6f, 0x4d,
0x53, 0x0d, 0x0e, 0x0e, 0x76, 0x21, 0xf1, 0xb8, 0xab, 0xab, 0x0b, 0xdd, 0xa4, 0x29, 0x96, 0x94,
0x94, 0x60, 0xdb, 0xb6, 0x6d, 0x98, 0x9f, 0x9f, 0x5f, 0x63, 0x44, 0x85, 0xa7, 0xa7, 0x27, 0xe9,
0xe0, 0x32, 0xda, 0xc8, 0xcf, 0xcf, 0x0f, 0x71, 0x71, 0x71, 0x34, 0x65, 0x65, 0x65, 0x24, 0x9d,
0x2d, 0x26, 0x4e, 0x6a, 0x8a, 0xfa, 0x70, 0xd8, 0xe1, 0xf7, 0x9f, 0xfb, 0x3e, 0xda, 0xb8, 0x71,
0xa3, 0x21, 0x34, 0x34, 0x14, 0xe1, 0xe1, 0xe1, 0x28, 0x2e, 0x2e, 0x86, 0x5e, 0xaf, 0xa7, 0x45,
0x9f, 0x67, 0xe4, 0xe5, 0xe5, 0x05, 0xb9, 0x5c, 0xbe, 0x26, 0x75, 0x62, 0xb1, 0x18, 0x12, 0x49,
0x4f, 0xa0, 0xbf, 0xbf, 0xbf, 0xb3, 0xfd, 0x7d, 0x44, 0xc2, 0x99, 0xe0, 0x4a, 0x78, 0x87, 0xb0,
0x85, 0x18, 0x4d, 0x3c, 0x9d, 0x3a, 0x5b, 0xac, 0x36, 0x32, 0x1a, 0x8d, 0xf4, 0xf9, 0xbd, 0x28,
0x75, 0x42, 0xa1, 0x70, 0xff, 0x8a, 0xa6, 0xeb, 0x8a, 0x87, 0xd3, 0x06, 0xc2, 0xeb, 0x04, 0x17,
0xc2, 0xdb, 0xc4, 0xc8, 0xf8, 0x22, 0xa3, 0x10, 0xd2, 0xd1, 0xa9, 0x42, 0x28, 0x2a, 0x2a, 0xa2,
0x77, 0x53, 0x58, 0x58, 0x68, 0x2f, 0x86, 0xd5, 0x46, 0x64, 0x57, 0x7b, 0x56, 0x34, 0x9d, 0x69,
0x8f, 0xd5, 0xa9, 0xdb, 0xbe, 0x7d, 0x7b, 0xe6, 0xd2, 0xd2, 0xd2, 0x1a, 0x23, 0xea, 0xdc, 0x38,
0x1c, 0x0e, 0x0d, 0xb5, 0xb3, 0x3b, 0x77, 0xee, 0xd8, 0xe7, 0x44, 0x22, 0x11, 0x3a, 0x3b, 0x3b,
0x57, 0xdf, 0xe2, 0xed, 0xd0, 0xe7, 0xd6, 0xff, 0xe5, 0x5f, 0x87, 0x46, 0x7a, 0x2c, 0x77, 0x09,
0x78, 0x4a, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE plot_pdf_xpm[1] = {{ png, sizeof( png ), "plot_pdf_xpm" }};
//EOF

View File

@ -0,0 +1,633 @@
<?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"
id="svg2"
inkscape:version="0.48.1 "
sodipodi:docname="plot_ps.svg">
<metadata
id="metadata173">
<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>
<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="namedview171"
showgrid="false"
inkscape:zoom="15.4375"
inkscape:cx="24"
inkscape:cy="24"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<defs
id="defs4">
<linearGradient
id="aa"
y2="20"
gradientUnits="userSpaceOnUse"
x2="20.125"
gradientTransform="matrix(1 0 0 .66667 1.9997 -2.3333)"
y1="24.438"
x1="20.125">
<stop
offset="0"
id="stop7" />
<stop
stop-opacity="0"
offset="1"
id="stop9" />
</linearGradient>
<linearGradient
id="z"
y2="33.469"
gradientUnits="userSpaceOnUse"
x2="41.82"
gradientTransform="translate(2.4997,-9)"
y1="33.109"
x1="41.82">
<stop
stop-color="#fff"
offset="0"
id="stop12" />
<stop
stop-color="#fff"
stop-opacity="0"
offset="1"
id="stop14" />
</linearGradient>
<linearGradient
id="at"
y2="31.168"
gradientUnits="userSpaceOnUse"
x2="38.743"
gradientTransform="matrix(.88533 0 0 1.4995 7.488 -20.734)"
y1="29.744"
x1="38.743">
<stop
stop-color="#babdb6"
offset="0"
id="stop17" />
<stop
stop-color="#fff"
offset="1"
id="stop19" />
</linearGradient>
<linearGradient
id="as"
y2="29.085"
gradientUnits="userSpaceOnUse"
x2="40.791"
gradientTransform="matrix(.66667 0 0 1 17 -5)"
y1="30.003"
x1="40.791">
<stop
stop-color="#789e2d"
offset="0"
id="stop22" />
<stop
stop-color="#a7cc5c"
offset="1"
id="stop24" />
</linearGradient>
<linearGradient
id="ae"
y2="20.14"
gradientUnits="userSpaceOnUse"
x2="17.5"
gradientTransform="matrix(1.0039 0 0 .98413 2.9558 -8.7031)"
y1="30.755"
x1="17.5">
<stop
stop-color="#2e3436"
offset="0"
id="stop27" />
<stop
stop-color="#babdb6"
offset="1"
id="stop29" />
</linearGradient>
<linearGradient
id="ad"
y2="42.336"
gradientUnits="userSpaceOnUse"
x2="3.6239"
gradientTransform="translate(2.9997,-8)"
y1="38.1"
x1="3.6239">
<stop
stop-color="#fff"
offset="0"
id="stop32" />
<stop
stop-color="#fff"
stop-opacity="0"
offset="1"
id="stop34" />
</linearGradient>
<linearGradient
id="y"
y2="69.14"
gradientUnits="userSpaceOnUse"
x2="5.1265"
gradientTransform="translate(1.9997,-10)"
y1="25.373"
x1="5.1265">
<stop
stop-color="#fff"
offset="0"
id="stop37" />
<stop
stop-color="#fff"
stop-opacity="0"
offset="1"
id="stop39" />
</linearGradient>
<linearGradient
id="ac"
y2="41.012"
gradientUnits="userSpaceOnUse"
x2="3.2641"
gradientTransform="translate(2.9997,-8)"
y1="35.073"
x1="3.2641">
<stop
stop-color="#555753"
offset="0"
id="stop42" />
<stop
stop-color="#2e3436"
offset="1"
id="stop44" />
</linearGradient>
<linearGradient
id="ab"
y2="37.148"
gradientUnits="userSpaceOnUse"
x2="5.057"
gradientTransform="translate(2.9997,-8)"
y1="40.415"
x1="5.057">
<stop
stop-color="#2e3436"
offset="0"
id="stop47" />
<stop
stop-color="#555753"
offset="1"
id="stop49" />
</linearGradient>
<linearGradient
id="x"
y2="24.368"
gradientUnits="userSpaceOnUse"
x2=".75"
gradientTransform="translate(1.9997,-10)"
y1="67.989"
x1=".75">
<stop
stop-color="#555753"
offset="0"
id="stop52" />
<stop
stop-color="#888a85"
offset="1"
id="stop54" />
</linearGradient>
<linearGradient
id="ar"
y2="24.249"
gradientUnits="userSpaceOnUse"
x2="35.5"
gradientTransform="matrix(1 0 0 .92157 1.9997 -3.7219)"
y1="31.19"
x1="35.5">
<stop
stop-color="#d3d7cf"
offset="0"
id="stop57" />
<stop
stop-color="#eeeeec"
offset="1"
id="stop59" />
</linearGradient>
<radialGradient
id="aq"
gradientUnits="userSpaceOnUse"
cy="38.763"
cx="25.323"
gradientTransform="matrix(1 0 0 .1944 0 31.228)"
r="25.235">
<stop
offset="0"
id="stop62" />
<stop
stop-opacity="0"
offset="1"
id="stop64" />
</radialGradient>
<linearGradient
id="af"
y2="43"
gradientUnits="userSpaceOnUse"
x2="15.186"
gradientTransform="matrix(1.129,0,0,1,-2.0968,-9)"
y1="36"
x1="15.177">
<stop
stop-color="#888a85"
offset="0"
id="stop67" />
<stop
stop-color="#555753"
offset="1"
id="stop69" />
</linearGradient>
<linearGradient
id="ag"
y2="45.969"
gradientUnits="userSpaceOnUse"
x2="10"
gradientTransform="matrix(1.1212 0 0 1 -.90909 -8)"
y1="40.969"
x1="9.9688">
<stop
stop-color="#eeeeec"
offset="0"
id="stop72" />
<stop
stop-color="#babdb6"
offset=".27381"
id="stop74" />
<stop
stop-color="#fff"
offset=".55910"
id="stop76" />
<stop
stop-color="#eeeeec"
offset="1"
id="stop78" />
</linearGradient>
<linearGradient
id="ah"
y2="40"
gradientUnits="userSpaceOnUse"
x2="40.375"
gradientTransform="matrix(1.1212 0 0 1 -.90909 -8)"
y1="45.625"
x1="40.375">
<stop
stop-color="#555753"
offset="0"
id="stop81" />
<stop
stop-color="#a1a59b"
offset="1"
id="stop83" />
</linearGradient>
<linearGradient
id="ai"
y2="32.515"
gradientUnits="userSpaceOnUse"
x2="34.482"
gradientTransform="matrix(1.1454,0,0,1,-1.4536,-5)"
y1="42.002"
x1="34.482">
<stop
stop-color="#eeeeec"
offset="0"
id="stop86" />
<stop
stop-color="#fff"
offset=".10714"
id="stop88" />
<stop
stop-color="#d3d7cf"
offset="1"
id="stop90" />
</linearGradient>
<linearGradient
id="aj"
y2="35.789"
gradientUnits="userSpaceOnUse"
x2="41.498"
gradientTransform="matrix(1.1454,0,0,1,-1.4536,-5)"
y1="40.9"
x1="41.498">
<stop
stop-color="#babdb6"
offset="0"
id="stop93" />
<stop
stop-color="#888a85"
offset="1"
id="stop95" />
</linearGradient>
<linearGradient
id="ak"
y2="40.048"
gradientUnits="userSpaceOnUse"
x2="15.312"
gradientTransform="matrix(1.1333,0,0,1,-2.2,-8)"
y1="31.45"
x1="15.312">
<stop
offset="0"
id="stop98" />
<stop
stop-opacity="0"
offset="1"
id="stop100" />
</linearGradient>
<linearGradient
id="al"
y2="42.403"
gradientUnits="userSpaceOnUse"
x2="27.907"
gradientTransform="matrix(1.08 0 0 1.0039 .080008 -7.022)"
y1="6.0832"
x1="12.171">
<stop
stop-color="#fff"
offset="0"
id="stop103" />
<stop
stop-color="#babdb6"
offset="1"
id="stop105" />
</linearGradient>
<linearGradient
id="am"
y2="13.749"
gradientUnits="userSpaceOnUse"
x2="36.523"
gradientTransform="matrix(1.08 0 0 1.0039 .080008 -11.038)"
y1="24.545"
x1="36.523">
<stop
stop-color="#888a85"
offset="0"
id="stop108" />
<stop
stop-color="#888a85"
offset="1"
id="stop110" />
</linearGradient>
<linearGradient
id="an"
y2="-11.027"
gradientUnits="userSpaceOnUse"
x2="15.438"
gradientTransform="translate(2,-5.4972)"
y1="20.773"
x1="27.568">
<stop
stop-color="#888a85"
offset="0"
id="stop113" />
<stop
stop-color="#888a85"
stop-opacity="0"
offset="1"
id="stop115" />
</linearGradient>
<linearGradient
id="ao"
y2="2.5"
gradientUnits="userSpaceOnUse"
x2="17.625"
gradientTransform="translate(2,-5.4972)"
y1="17.471"
x1="21.875">
<stop
stop-color="#2e3436"
offset="0"
id="stop118" />
<stop
stop-color="#888a85"
offset="1"
id="stop120" />
</linearGradient>
<linearGradient
id="ap"
y2="28.82"
gradientUnits="userSpaceOnUse"
x2="34.825"
gradientTransform="translate(2,-5.4972)"
y1="6.1923"
x1="21.567">
<stop
stop-color="#fff"
offset="0"
id="stop123" />
<stop
stop-color="#fff"
stop-opacity="0"
offset="1"
id="stop125" />
</linearGradient>
</defs>
<path
opacity=".8"
d="m26-2.5c-2.7062 0-5.5 2-5.5 2-0.56888 0-1 3.984-1 5v12h13v-12c0-1.016-0.43112-5-1-5 0 0-2.7938-2-5.5-2zm0 6c0.828 0 1.5-0.536 1.5 2.5s-0.6395 7.5028-1.4675 7.5028-1.532-4.467-1.532-7.503 0.672-2.5 1.5-2.5z"
fill-rule="evenodd"
stroke="url(#ao)"
stroke-linecap="square"
fill="url(#an)"
id="path127" />
<path
opacity=".7"
stroke-linejoin="round"
d="m26-1.5c-2.2158 0-4.7813 1.8153-4.7813 1.8153-0.0014 0.00322-0.02974-0.00349-0.03125 0-0.01757 0.040692-0.0085 0.055839-0.03125 0.125-0.095 0.28845-0.192 0.7665-0.281 1.2812-0.177 1.0295-0.375 2.4215-0.375 2.7785l0.09374 11.159h10.875l0.031-11.159c0-0.35697-0.13519-1.749-0.31251-2.7785-0.088-0.5147-0.186-0.99275-0.281-1.2812-0.023-0.06916-0.014-0.08431-0.031-0.125-0.006-0.01279-0.027-0.0222-0.031-0.03125 0 0-2.628-1.784-4.844-1.784z"
stroke="url(#ap)"
stroke-linecap="square"
fill="none"
id="path129" />
<path
opacity=".3"
d="m50.558 38.763a25.235 4.9056 0 1 1 -50.47 0 25.235 4.9056 0 1 1 50.47 0z"
transform="matrix(1.0693 0 0 .56059 -3.0645 20.52)"
fill="url(#aq)"
id="path131" />
<path
stroke-linejoin="round"
d="m8.9997 11.5-2.25 2.7488c-2.1506 2.6273-3.25 5.0686-3.25 8.7549v5.496h45v-5.4963c0-3.6863-1.0994-6.1276-3.25-8.7549l-2.25-2.749h-34z"
stroke="url(#x)"
stroke-linecap="square"
fill="url(#ar)"
id="path133" />
<path
stroke-linejoin="round"
style="enable-background:new"
d="m4.4997 28.5v2.9062c0 1.1517 0.942 2.0938 2.0937 2.0938h38.812c1.1517 0 2.0938-0.942 2.0938-2.0938v-2.906h-43z"
stroke="url(#ac)"
stroke-linecap="round"
fill="url(#ab)"
id="path135" />
<path
d="m9.5116 12.562-1.9122 2.289c-2.0354 2.437-3.0997 4.486-3.0997 7.857v4.792h43v-4.792c0-3.3701-1.0721-5.4135-3.0997-7.8562l-1.9-2.29h-32.988z"
stroke="url(#y)"
stroke-linecap="square"
fill="none"
id="path137" />
<path
opacity="0.08"
style="enable-background:new"
d="m46.5 29.5v2c0 0.51882-0.48118 1-1 1h-39c-0.51882 0-1-0.48118-1-1v-2h41z"
stroke="url(#ad)"
stroke-linecap="round"
fill="none"
id="path139" />
<rect
stroke-linejoin="round"
style="enable-background:new"
rx=".50781"
ry=".5"
height="10"
width="29"
stroke="#2e3436"
stroke-linecap="round"
y="12.5"
x="11.5"
stroke-width=".99978"
fill="url(#ae)"
id="rect141" />
<path
stroke-linejoin="round"
d="m14.12 6.4995h23.76c0.89748 0 1.62 0.67161 1.62 1.5059v6.5566l-27-1.004v-5.5527c0-0.83425 0.72252-1.5059 1.62-1.5059z"
stroke="url(#am)"
stroke-linecap="square"
fill="url(#al)"
id="path143" />
<rect
stroke-linejoin="round"
rx=".62364"
ry=".53125"
height="5.9983"
width="24.999"
stroke="#fff"
stroke-linecap="square"
y="7.4995"
x="13.5"
fill="none"
id="rect145" />
<rect
rx="1"
ry="1"
height="2"
width="3"
stroke="url(#at)"
stroke-linecap="square"
y="23.5"
x="43"
fill="url(#as)"
id="rect147" />
<rect
rx=".51562"
ry=".17969"
height=".35937"
width="1.5469"
y="24.109"
x="43.734"
fill="url(#z)"
id="rect149" />
<rect
opacity=".15"
fill-rule="evenodd"
rx="0"
ry="0"
height="2"
width="28"
y="11"
x="12"
fill="url(#aa)"
id="rect151" />
<path
style="enable-background:new"
d="m12.5 13.5h27"
fill-opacity=".75"
fill-rule="evenodd"
stroke="#2e3436"
stroke-linecap="square"
stroke-width=".99994"
fill="#888a85"
id="path153" />
<path
d="m11.194 27.5h29.612c0.96368 0 1.6935 0.63554 1.6935 1.2996v4.7l-33 0.000009v-4.7004c0-0.74044 0.77366-1.2996 1.6935-1.2996z"
stroke="url(#af)"
stroke-linecap="square"
fill="#6a6f64"
id="path155" />
<path
stroke-linejoin="round"
d="m10.303 32.5h31.394c1.6468 0 1.1212 2 1.1212 2l1.682 2.5c0 1.385-1.2502 1.5-2.803 1.5h-31.394c-1.5524 0-2.8026-0.115-2.8026-1.5l1.6818-2.5s-0.56061-2 1.1212-2z"
stroke="url(#ah)"
stroke-linecap="round"
fill="url(#ag)"
id="path157" />
<path
stroke-linejoin="round"
d="m40.352 28c0 5 1.718 8.5 1.718 8.5h-32.07s1.718-3.5 1.718-8.5"
stroke="url(#aj)"
fill="url(#ai)"
id="path159" />
<path
fill="none"
d="m39.34 28c-0.03625 4 1.16 7.5 1.16 7.5h-29s1.16-3.5 1.16-7.5"
stroke="#fff"
id="path161" />
<path
opacity=".50588"
fill="url(#ak)"
d="m11.133 28h29.733c0.935 0 1.134 0.447 1.134 1v4h-32v-4c0-0.61703 0.24178-1 1.1333-1z"
id="path163" />
<rect
fill-rule="evenodd"
height="16.15"
width="32"
y="30"
x="9"
fill="#fff"
id="rect165" />
<text
style="font-size:41.50999832px;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;font-family:Sans"
xml:space="preserve"
transform="scale(0.98833,1.0118)"
line-height="125%"
font-size="41.51px"
y="44.47496"
x="24.283327"
id="text167"
sodipodi:linespacing="125%"><tspan
style="font-size:18px;font-weight:bold;text-align:center;text-anchor:middle;font-family:Saab"
font-size="18px"
y="44.47496"
x="24.283327"
font-weight="bold"
id="tspan169">PDF</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -35,6 +35,7 @@ set(COMMON_SRCS
build_version.cpp
class_bitmap_base.cpp
class_colors_design_settings.cpp
class_layer_box_selector.cpp
class_marker_base.cpp
class_plotter.cpp
class_undoredo_container.cpp
@ -42,6 +43,7 @@ set(COMMON_SRCS
common_plot_functions.cpp
common_plotHPGL_functions.cpp
common_plotPS_functions.cpp
common_plotPDF_functions.cpp
common_plotGERBER_functions.cpp
common_plotDXF_functions.cpp
confirm.cpp
@ -87,7 +89,6 @@ set(PCB_COMMON_SRCS
class_page_info.cpp
pcbcommon.cpp
footprint_info.cpp
class_layer_box_selector.cpp
../pcbnew/basepcbframe.cpp
../pcbnew/class_board.cpp
../pcbnew/class_board_connected_item.cpp
@ -116,6 +117,7 @@ set(PCB_COMMON_SRCS
../pcbnew/sel_layer.cpp
../pcbnew/pcb_plot_params.cpp
../pcbnew/io_mgr.cpp
../pcbnew/eagle_plugin.cpp
../pcbnew/legacy_plugin.cpp
../pcbnew/kicad_plugin.cpp
pcb_plot_params_keywords.cpp

View File

@ -35,17 +35,13 @@
#include <id.h>
#include <base_units.h>
#define CURSOR_SIZE 12 /// size of the cross cursor.
BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) :
EDA_ITEM( aType )
{
m_UndoRedoCountMax = 10; // undo/Redo command Max depth, 10 is a reasonable value
m_FirstRedraw = true;
m_ScreenNumber = 1;
m_NumberOfScreen = 1; // Hierarchy: Root: ScreenNumber = 1
m_NumberOfScreens = 1; // Hierarchy: Root: ScreenNumber = 1
m_Zoom = 32.0;
m_Grid.m_Size = wxRealPoint( 50, 50 ); // Default grid size
m_Grid.m_Id = ID_POPUP_GRID_LEVEL_50;
@ -98,16 +94,8 @@ double BASE_SCREEN::GetScalingFactor() const
void BASE_SCREEN::SetScalingFactor( double aScale )
{
double zoom = aScale;
// Limit zoom to max and min allowed values:
if( zoom < m_ZoomList[0] )
zoom = m_ZoomList[0];
int idxmax = m_ZoomList.GetCount() - 1;
if( zoom > m_ZoomList[idxmax] )
zoom = m_ZoomList[idxmax];
double zoom = Clamp( GetMinAllowedZoom(), aScale, GetMaxAllowedZoom() );
SetZoom( zoom );
}
@ -115,38 +103,30 @@ void BASE_SCREEN::SetScalingFactor( double aScale )
bool BASE_SCREEN::SetFirstZoom()
{
if( m_ZoomList.IsEmpty() )
{
if( m_Zoom != 1.0 )
{
SetZoom( 1.0 );
return true;
}
}
else if( m_Zoom != m_ZoomList[0] )
{
SetZoom( m_ZoomList[0] );
return true;
}
return false;
return SetZoom( GetMinAllowedZoom() );
}
double BASE_SCREEN::GetZoom() const
bool BASE_SCREEN::SetLastZoom()
{
return m_Zoom;
return SetZoom( GetMaxAllowedZoom() );
}
bool BASE_SCREEN::SetZoom( double coeff )
bool BASE_SCREEN::SetZoom( double iu_per_du )
{
if( coeff == m_Zoom )
if( iu_per_du == m_Zoom )
return false;
wxLogDebug( "Zoom:%16g 1/Zoom:%16g", coeff, 1/coeff );
wxLogDebug( "Zoom:%.16g 1/Zoom:%.16g", iu_per_du, 1/iu_per_du );
m_Zoom = coeff;
if( iu_per_du < GetMinAllowedZoom() )
return false;
if( iu_per_du > GetMaxAllowedZoom() )
return false;
m_Zoom = iu_per_du;
return true;
}
@ -154,10 +134,7 @@ bool BASE_SCREEN::SetZoom( double coeff )
bool BASE_SCREEN::SetNextZoom()
{
if( m_ZoomList.IsEmpty() || m_Zoom >= m_ZoomList.Last() )
return false;
for( unsigned i = 0; i < m_ZoomList.GetCount(); i++ )
for( unsigned i=0; i < m_ZoomList.size(); ++i )
{
if( m_Zoom < m_ZoomList[i] )
{
@ -172,10 +149,7 @@ bool BASE_SCREEN::SetNextZoom()
bool BASE_SCREEN::SetPreviousZoom()
{
if( m_ZoomList.IsEmpty() || m_Zoom <= m_ZoomList[0] )
return false;
for( unsigned i = m_ZoomList.GetCount(); i != 0; i-- )
for( unsigned i = m_ZoomList.size(); i != 0; --i )
{
if( m_Zoom > m_ZoomList[i - 1] )
{
@ -188,15 +162,6 @@ bool BASE_SCREEN::SetPreviousZoom()
}
bool BASE_SCREEN::SetLastZoom()
{
if( m_ZoomList.IsEmpty() || m_Zoom == m_ZoomList.Last() )
return false;
return SetZoom( m_ZoomList.Last() );
}
void BASE_SCREEN::SetGridList( GRIDS& gridlist )
{
if( !m_grids.empty() )
@ -320,31 +285,8 @@ GRID_TYPE& BASE_SCREEN::GetGrid( size_t aIndex )
}
GRID_TYPE BASE_SCREEN::GetGrid()
{
return m_Grid;
}
const wxPoint& BASE_SCREEN::GetGridOrigin()
{
return m_GridOrigin;
}
wxRealPoint BASE_SCREEN::GetGridSize()
{
return m_Grid.m_Size;
}
int BASE_SCREEN::GetGridId()
{
return m_Grid.m_Id;
}
wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize )
wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition,
wxRealPoint* aGridSize ) const
{
wxPoint pt;
wxRealPoint gridSize;
@ -368,7 +310,7 @@ wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition, wxRealPoi
}
wxPoint BASE_SCREEN::GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize )
wxPoint BASE_SCREEN::GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize ) const
{
if( aOnGrid )
return GetNearestGridPosition( m_crossHairPosition, aGridSize );

View File

@ -40,7 +40,7 @@
#include <base_units.h>
#if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA )
#if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW )
#define IU_TO_MM( x ) ( x / IU_PER_MM )
#define IU_TO_IN( x ) ( x / IU_PER_MILS / 1000 )
#define MM_TO_IU( x ) ( x * IU_PER_MM )

View File

@ -251,18 +251,18 @@ void BITMAP_BASE::Rotate( bool aRotateCCW )
}
void BITMAP_BASE::PlotImage( PLOTTER* aPlotter,
wxPoint aPos,
int aDefaultColor,
int aDefaultPensize )
void BITMAP_BASE::PlotImage( PLOTTER* aPlotter,
const wxPoint& aPos,
EDA_COLOR_T aDefaultColor,
int aDefaultPensize )
{
if( m_image == NULL )
return;
// These 2 lines are useful only fot plotters that cannot plot a bitmap
// and plot arectangle instead of.
aPlotter->set_color( aDefaultColor );
aPlotter->set_current_line_width( aDefaultPensize );
aPlotter->SetColor( aDefaultColor );
aPlotter->SetCurrentLineWidth( aDefaultPensize );
aPlotter->PlotImage( *m_image, aPos, GetScalingFactor() );
}

View File

@ -1,19 +1,13 @@
#include <common.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <class_board_design_settings.h>
#include <colors_selection.h>
#include <layers_id_colors_and_visibility.h>
#include <bitmaps.h>
#include <hotkeys.h>
#include <help_common_strings.h>
#include <class_board.h>
#include <colors.h>
#include <wx/wx.h>
#include <wx/ownerdrw.h>
#include <wx/menuitem.h>
#include <wx/bmpcbox.h>
#include <wx/wx.h>
#include <wx/aui/aui.h>
#include <class_layer_box_selector.h>
@ -101,79 +95,30 @@ int LAYER_BOX_SELECTOR::SetLayerSelection( int layer )
return -1;
}
// Reload the Layers
void LAYER_BOX_SELECTOR::Resync()
{
PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
BOARD* board = pcbFrame->GetBoard();
wxASSERT( board != NULL );
Clear();
static DECLARE_LAYERS_ORDER_LIST( layertranscode );
static DECLARE_LAYERS_HOTKEY( layerhk );
for( int i = 0; i < LAYER_COUNT; i++ )
{
wxBitmap layerbmp( 14, 14 );
wxMemoryDC bmpDC;
wxBrush brush;
wxString layername;
int layerid = i;
if( m_layerorder )
layerid = layertranscode[i];
if( !board->IsLayerEnabled( layerid ) )
continue;
// Prepare Bitmap
bmpDC.SelectObject( layerbmp );
brush.SetColour( MakeColour( board->GetLayerColor( layerid ) ) );
brush.SetStyle( wxSOLID );
bmpDC.SetBrush( brush );
bmpDC.DrawRectangle( 0, 0, layerbmp.GetWidth(), layerbmp.GetHeight() );
bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
bmpDC.SetPen( *wxBLACK_PEN );
bmpDC.DrawRectangle( 0, 0, layerbmp.GetWidth(), layerbmp.GetHeight() );
layername = board->GetLayerName( layerid );
if( m_layerhotkeys && m_hotkeys != NULL )
layername = AddHotkeyName( layername, m_hotkeys, layerhk[layerid], IS_COMMENT );
Append( layername, layerbmp, (void*) layerid );
}
}
void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
{
PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
BOARD* board = pcbFrame->GetBoard();
int elements = GetCount();
for( int i = 0; i < elements; i++ )
{
wxBitmap layerbmp( 14, 14 );
wxMemoryDC bmpDC;
wxBrush brush;
wxString layername;
int layerid = i;
// Prepare Bitmap
bmpDC.SelectObject( layerbmp );
brush.SetColour( MakeColour( board->GetLayerColor( layerid ) ) );
brush.SetStyle( wxSOLID );
bmpDC.SetBrush( brush );
bmpDC.DrawRectangle( 0, 0, layerbmp.GetWidth(), layerbmp.GetHeight() );
bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
bmpDC.SetPen( *wxBLACK_PEN );
bmpDC.DrawRectangle( 0, 0, layerbmp.GetWidth(), layerbmp.GetHeight() );
SetItemBitmap(i, layerbmp);
wxBitmap layerbmp( 14, 14 );
SetBitmapLayer( layerbmp, i );
}
}
void LAYER_BOX_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, int aLayerIndex )
{
wxMemoryDC bmpDC;
wxBrush brush;
// Prepare Bitmap
bmpDC.SelectObject( aLayerbmp );
brush.SetColour( MakeColour( GetLayerColor( aLayerIndex ) ) );
brush.SetStyle( wxSOLID );
bmpDC.SetBrush( brush );
bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
bmpDC.SetPen( *wxBLACK_PEN );
bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
}

View File

@ -1,13 +1,17 @@
/******************************************
* class_plotter.cpp
* the class PLOTTER handle basic functions to plot schematic and boards
* with different plot formats.
* currently formats are:*
* HPGL
* POSTSCRIPT
* GERBER
* DXF
******************************************/
/**
* @file class_plotter.cpp
* @brief KiCad: Base of all the plot routines
* the class PLOTTER handle basic functions to plot schematic and boards
* with different plot formats.
*
* There are currently engines for:
* HPGL
* POSTSCRIPT
* GERBER
* DXF
* an SVG 'plot' is also provided along with the 'print' function by wx, but
* is not handled here.
*/
#include <fctsys.h>
@ -21,112 +25,152 @@
#include <class_base_screen.h>
#include <drawtxt.h>
PLOTTER::PLOTTER( PlotFormat aPlotType )
PLOTTER::PLOTTER( )
{
m_PlotType = aPlotType;
plot_scale = 1;
default_pen_width = 0;
current_pen_width = -1; /* To-be-set marker */
pen_state = 'Z'; /* End-of-path idle */
plotMirror = 0; /* Mirror flag */
output_file = 0;
color_mode = false; /* Start as a BW plot */
negative_mode = false;
plotScale = 1;
defaultPenWidth = 0;
currentPenWidth = -1; // To-be-set marker
penState = 'Z'; // End-of-path idle
plotMirror = 0; // Mirror flag
outputFile = 0;
colorMode = false; // Starts as a BW plot
negativeMode = false;
}
/* Modifies coordinates pos.x and pos.y trace according to the orientation,
* scale factor, and offsets trace
/**
* Modifies coordinates according to the orientation,
* scale factor, and offsets trace. Also convert from a wxPoint to DPOINT,
* since some output engines needs floating point coordinates.
*/
void PLOTTER::user_to_device_coordinates( wxPoint& pos )
DPOINT PLOTTER::userToDeviceCoordinates( const wxPoint& pos )
{
pos.x = (int) ( (pos.x - plot_offset.x) * plot_scale * device_scale );
double x = (pos.x - plotOffset.x) * plotScale * iuPerDeviceUnit;
double y;
if( plotMirror )
pos.y = (int) ( ( pos.y - plot_offset.y ) * plot_scale * device_scale );
y = ( pos.y - plotOffset.y ) * plotScale * iuPerDeviceUnit ;
else
pos.y = (int) ( ( paper_size.y - ( pos.y - plot_offset.y )
* plot_scale ) * device_scale );
y = ( paperSize.y - ( pos.y - plotOffset.y )
* plotScale ) * iuPerDeviceUnit ;
return DPOINT( x, y );
}
/**
* Modifies size according to the plotter scale factors
* (wxSize version, returns a DPOINT)
*/
DPOINT PLOTTER::userToDeviceSize( const wxSize& size )
{
return DPOINT( size.x * plotScale * iuPerDeviceUnit,
size.y * plotScale * iuPerDeviceUnit );
}
/**
* Modifies size according to the plotter scale factors
* (simple double version)
*/
double PLOTTER::userToDeviceSize( double size )
{
return size * plotScale * iuPerDeviceUnit;
}
/* Generic arc rendered as a polyline */
void PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int radius,
/**
* Generic fallback: arc rendered as a polyline
*/
void PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius,
FILL_T fill, int width )
{
wxPoint start, end;
const int delta = 50; /* increment (in 0.1 degrees) to draw circles */
const int delta = 50; // increment (in 0.1 degrees) to draw circles
double alpha;
if( StAngle > EndAngle )
EXCHG( StAngle, EndAngle );
set_current_line_width( width );
SetCurrentLineWidth( width );
/* Please NOTE the different sign due to Y-axis flip */
alpha = StAngle / 1800.0 * M_PI;
alpha = DEG2RAD( StAngle / 10.0 );
start.x = centre.x + (int) ( radius * cos( -alpha ) );
start.y = centre.y + (int) ( radius * sin( -alpha ) );
move_to( start );
MoveTo( start );
for( int ii = StAngle + delta; ii < EndAngle; ii += delta )
{
alpha = ii / 1800.0 * M_PI;
alpha = DEG2RAD( ii / 10.0 );
end.x = centre.x + (int) ( radius * cos( -alpha ) );
end.y = centre.y + (int) ( radius * sin( -alpha ) );
line_to( end );
LineTo( end );
}
alpha = EndAngle / 1800.0 * M_PI;
alpha = DEG2RAD( EndAngle / 10.0 );
end.x = centre.x + (int) ( radius * cos( -alpha ) );
end.y = centre.y + (int) ( radius * sin( -alpha ) );
finish_to( end );
FinishTo( end );
}
/**
* Fallback: if it doesn't handle bitmaps, we plot a rectangle
*/
void PLOTTER::PlotImage(const wxImage & aImage, const wxPoint& aPos,
double aScaleFactor )
{
wxSize size( aImage.GetWidth() * aScaleFactor,
aImage.GetHeight() * aScaleFactor );
wxPoint start = aPos;
start.x -= size.x / 2;
start.y -= size.y / 2;
wxPoint end = start;
end.x += size.x;
end.y += size.y;
Rect( start, end, NO_FILL );
}
/* Modifies size size.x and size.y trace according to the scale factor. */
void PLOTTER::user_to_device_size( wxSize& size )
/**
* Plot a square centered on the position. Building block for markers
*/
void PLOTTER::markerSquare( const wxPoint& position, int radius )
{
size.x = (int) ( size.x * plot_scale * device_scale );
size.y = (int) ( size.y * plot_scale * device_scale );
}
double PLOTTER::user_to_device_size( double size )
{
return size * plot_scale * device_scale;
}
void PLOTTER::center_square( const wxPoint& position, int diametre, FILL_T fill )
{
int radius = KiROUND( diametre / 2.8284 );
static std::vector< wxPoint > corner_list;
corner_list.clear();
double r = KiROUND( radius / 1.4142 );
std::vector< wxPoint > corner_list;
wxPoint corner;
corner.x = position.x + radius;
corner.y = position.y + radius;
corner.x = position.x + r;
corner.y = position.y + r;
corner_list.push_back( corner );
corner.x = position.x + radius;
corner.y = position.y - radius;
corner.x = position.x + r;
corner.y = position.y - r;
corner_list.push_back( corner );
corner.x = position.x - radius;
corner.y = position.y - radius;
corner.x = position.x - r;
corner.y = position.y - r;
corner_list.push_back( corner );
corner.x = position.x - radius;
corner.y = position.y + radius;
corner.x = position.x - r;
corner.y = position.y + r;
corner_list.push_back( corner );
corner.x = position.x + radius;
corner.y = position.y + radius;
corner.x = position.x + r;
corner.y = position.y + r;
corner_list.push_back( corner );
PlotPoly( corner_list, fill );
PlotPoly( corner_list, NO_FILL );
}
void PLOTTER::center_lozenge( const wxPoint& position, int diametre, FILL_T fill )
/**
* Plot a circle centered on the position. Building block for markers
*/
void PLOTTER::markerCircle( const wxPoint& position, int radius )
{
int radius = diametre / 2;
static std::vector< wxPoint > corner_list;
corner_list.clear();
Circle( position, radius * 2, NO_FILL );
}
/**
* Plot a lozenge centered on the position. Building block for markers
*/
void PLOTTER::markerLozenge( const wxPoint& position, int radius )
{
std::vector< wxPoint > corner_list;
wxPoint corner;
corner.x = position.x;
corner.y = position.y + radius;
@ -144,115 +188,163 @@ void PLOTTER::center_lozenge( const wxPoint& position, int diametre, FILL_T fill
corner.y = position.y + radius;
corner_list.push_back( corner );
PlotPoly( corner_list, fill );
PlotPoly( corner_list, NO_FILL );
}
/**
* Plot a - bar centered on the position. Building block for markers
*/
void PLOTTER::markerHBar( const wxPoint& pos, int radius )
{
MoveTo( wxPoint( pos.x - radius, pos.y ) );
FinishTo( wxPoint( pos.x + radius, pos.y ) );
}
/* Draw a pattern shape number aShapeId, to coord x0, y0.
/**
* Plot a / bar centered on the position. Building block for markers
*/
void PLOTTER::markerSlash( const wxPoint& pos, int radius )
{
MoveTo( wxPoint( pos.x - radius, pos.y - radius ) );
FinishTo( wxPoint( pos.x + radius, pos.y + radius ) );
}
/**
* Plot a \ bar centered on the position. Building block for markers
*/
void PLOTTER::markerBackSlash( const wxPoint& pos, int radius )
{
MoveTo( wxPoint( pos.x + radius, pos.y - radius ) );
FinishTo( wxPoint( pos.x - radius, pos.y + radius ) );
}
/**
* Plot a | bar centered on the position. Building block for markers
*/
void PLOTTER::markerVBar( const wxPoint& pos, int radius )
{
MoveTo( wxPoint( pos.x, pos.y - radius ) );
FinishTo( wxPoint( pos.x, pos.y + radius ) );
}
/**
* Draw a pattern shape number aShapeId, to coord x0, y0.
* x0, y0 = coordinates tables
* Diameter diameter = (coord table) hole
* AShapeId = index (used to generate forms characters)
*/
void PLOTTER::marker( const wxPoint& position, int diametre, int aShapeId )
void PLOTTER::Marker( const wxPoint& position, int diametre, unsigned aShapeId )
{
int radius = diametre / 2;
int x0, y0;
x0 = position.x; y0 = position.y;
switch( aShapeId )
/* Marker are composed by a series of 'parts' superimposed; not every
combination make sense, obviously. Since they are used in order I
tried to keep the uglier/more complex constructions at the end.
Also I avoided the |/ |\ -/ -\ construction because they're *very*
ugly... if needed they could be added anyway... I'd like to see
a board with more than 58 drilling/slotting tools!
If Visual C++ supported the 0b literals they would be optimally
and easily encoded as an integer array. We have to do with octal */
static const unsigned char marker_patterns[MARKER_COUNT] = {
// Bit order: O Square Lozenge - | \ /
// First choice: simple shapes
0003, // X
0100, // O
0014, // +
0040, // Sq
0020, // Lz
// Two simple shapes
0103, // X O
0017, // X +
0043, // X Sq
0023, // X Lz
0114, // O +
0140, // O Sq
0120, // O Lz
0054, // + Sq
0034, // + Lz
0060, // Sq Lz
// Three simple shapes
0117, // X O +
0143, // X O Sq
0123, // X O Lz
0057, // X + Sq
0037, // X + Lz
0063, // X Sq Lz
0154, // O + Sq
0134, // O + Lz
0074, // + Sq Lz
// Four simple shapes
0174, // O Sq Lz +
0163, // X O Sq Lz
0157, // X O Sq +
0137, // X O Lz +
0077, // X Sq Lz +
// This draws *everything *
0177, // X O Sq Lz +
// Here we use the single bars... so the cross is forbidden
0110, // O -
0104, // O |
0101, // O /
0050, // Sq -
0044, // Sq |
0041, // Sq /
0030, // Lz -
0024, // Lz |
0021, // Lz /
0150, // O Sq -
0144, // O Sq |
0141, // O Sq /
0130, // O Lz -
0124, // O Lz |
0121, // O Lz /
0070, // Sq Lz -
0064, // Sq Lz |
0061, // Sq Lz /
0170, // O Sq Lz -
0164, // O Sq Lz |
0161, // O Sq Lz /
// Last resort: the backlash component (easy to confound)
0102, // \ O
0042, // \ Sq
0022, // \ Lz
0142, // \ O Sq
0122, // \ O Lz
0062, // \ Sq Lz
0162 // \ O Sq Lz
};
if( aShapeId >= MARKER_COUNT )
{
case 0: /* vias : X shape */
move_to( wxPoint( x0 - radius, y0 - radius ) );
line_to( wxPoint( x0 + radius, y0 + radius ) );
move_to( wxPoint( x0 + radius, y0 - radius ) );
finish_to( wxPoint( x0 - radius, y0 + radius ) );
break;
case 1: /* Circle */
circle( position, diametre, NO_FILL );
break;
case 2: /* + shape */
move_to( wxPoint( x0, y0 - radius ) );
line_to( wxPoint( x0, y0 + radius ) );
move_to( wxPoint( x0 + radius, y0 ) );
finish_to( wxPoint( x0 - radius, y0 ) );
break;
case 3: /* X shape in circle */
circle( position, diametre, NO_FILL );
move_to( wxPoint( x0 - radius, y0 - radius ) );
line_to( wxPoint( x0 + radius, y0 + radius ) );
move_to( wxPoint( x0 + radius, y0 - radius ) );
finish_to( wxPoint( x0 - radius, y0 + radius ) );
break;
case 4: /* circle with bar - shape */
circle( position, diametre, NO_FILL );
move_to( wxPoint( x0 - radius, y0 ) );
finish_to( wxPoint( x0 + radius, y0 ) );
break;
case 5: /* circle with bar | shape */
circle( position, diametre, NO_FILL );
move_to( wxPoint( x0, y0 - radius ) );
finish_to( wxPoint( x0, y0 + radius ) );
break;
case 6: /* square */
center_square( position, diametre, NO_FILL );
break;
case 7: /* diamond */
center_lozenge( position, diametre, NO_FILL );
break;
case 8: /* square with an X*/
center_square( position, diametre, NO_FILL );
move_to( wxPoint( x0 - radius, y0 - radius ) );
line_to( wxPoint( x0 + radius, y0 + radius ) );
move_to( wxPoint( x0 + radius, y0 - radius ) );
finish_to( wxPoint( x0 - radius, y0 + radius ) );
break;
case 9: /* diamond with a +*/
center_lozenge( position, diametre, NO_FILL );
move_to( wxPoint( x0, y0 - radius ) );
line_to( wxPoint( x0, y0 + radius ) );
move_to( wxPoint( x0 + radius, y0 ) );
finish_to( wxPoint( x0 - radius, y0 ) );
break;
case 10: /* square with a '/' */
center_square( position, diametre, NO_FILL );
move_to( wxPoint( x0 - radius, y0 - radius ) );
finish_to( wxPoint( x0 + radius, y0 + radius ) );
break;
case 11: /* square with a |*/
center_lozenge( position, diametre, NO_FILL );
move_to( wxPoint( x0, y0 - radius ) );
finish_to( wxPoint( x0, y0 + radius ) );
break;
case 12: /* square with a -*/
center_lozenge( position, diametre, NO_FILL );
move_to( wxPoint( x0 - radius, y0 ) );
finish_to( wxPoint( x0 + radius, y0 ) );
break;
default:
circle( position, diametre, NO_FILL );
break;
// Fallback shape
markerCircle( position, radius );
}
else
{
// Decode the pattern and draw the corresponding parts
unsigned char pat = marker_patterns[aShapeId];
if( pat & 0001 )
markerSlash( position, radius );
if( pat & 0002 )
markerBackSlash( position, radius );
if( pat & 0004 )
markerVBar( position, radius );
if( pat & 0010 )
markerHBar( position, radius );
if( pat & 0020 )
markerLozenge( position, radius );
if( pat & 0040 )
markerSquare( position, radius );
if( pat & 0100 )
markerCircle( position, radius );
}
}
/* Convert a thick segment and plot it as an oval */
void PLOTTER::segment_as_oval( wxPoint start, wxPoint end, int width,
EDA_DRAW_MODE_T tracemode )
/**
* Convert a thick segment and plot it as an oval
*/
void PLOTTER::segmentAsOval( const wxPoint& start, const wxPoint& end, int width,
EDA_DRAW_MODE_T tracemode )
{
wxPoint center( (start.x + end.x) / 2, (start.y + end.y) / 2 );
wxSize size( end.x - start.x, end.y - start.y );
@ -263,22 +355,22 @@ void PLOTTER::segment_as_oval( wxPoint start, wxPoint end, int width,
else if( size.x == 0 )
orient = 900;
else
orient = -(int) ( atan2( (double) size.y,
(double) size.x ) * 1800.0 / M_PI );
orient = -(int) ( RAD2DEG( atan2( size.y, size.x ) ) * 10.0 );
size.x = (int) sqrt( ( (double) size.x * size.x )
+ ( (double) size.y * size.y ) ) + width;
size.y = width;
flash_pad_oval( center, size, orient, tracemode );
FlashPadOval( center, size, orient, tracemode );
}
void PLOTTER::sketch_oval( wxPoint pos, wxSize size, int orient,
int width )
void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, int orient,
int width )
{
set_current_line_width( width );
width = current_pen_width;
SetCurrentLineWidth( width );
width = currentPenWidth;
int radius, deltaxy, cx, cy;
wxSize size( aSize );
if( size.x > size.y )
{
@ -293,31 +385,31 @@ void PLOTTER::sketch_oval( wxPoint pos, wxSize size, int orient,
cx = -radius;
cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient );
move_to( wxPoint( cx + pos.x, cy + pos.y ) );
MoveTo( wxPoint( cx + pos.x, cy + pos.y ) );
cx = -radius;
cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
finish_to( wxPoint( cx + pos.x, cy + pos.y ) );
FinishTo( wxPoint( cx + pos.x, cy + pos.y ) );
cx = radius;
cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient );
move_to( wxPoint( cx + pos.x, cy + pos.y ) );
MoveTo( wxPoint( cx + pos.x, cy + pos.y ) );
cx = radius;
cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
finish_to( wxPoint( cx + pos.x, cy + pos.y ) );
FinishTo( wxPoint( cx + pos.x, cy + pos.y ) );
cx = 0;
cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
arc( wxPoint( cx + pos.x, cy + pos.y ),
Arc( wxPoint( cx + pos.x, cy + pos.y ),
orient + 1800, orient + 3600,
radius, NO_FILL );
cx = 0;
cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient );
arc( wxPoint( cx + pos.x, cy + pos.y ),
Arc( wxPoint( cx + pos.x, cy + pos.y ),
orient, orient + 1800,
radius, NO_FILL );
}
@ -325,98 +417,98 @@ void PLOTTER::sketch_oval( wxPoint pos, wxSize size, int orient,
/* Plot 1 segment like a track segment
*/
void PLOTTER::thick_segment( wxPoint start, wxPoint end, int width,
EDA_DRAW_MODE_T tracemode )
{
switch( tracemode )
{
case FILLED:
case LINE:
set_current_line_width( tracemode==FILLED ? width : -1 );
move_to( start );
finish_to( end );
break;
case SKETCH:
set_current_line_width( -1 );
segment_as_oval( start, end, width, tracemode );
break;
}
}
void PLOTTER::thick_arc( wxPoint centre, int StAngle, int EndAngle, int radius,
int width, EDA_DRAW_MODE_T tracemode )
{
switch( tracemode )
{
case LINE:
set_current_line_width( -1 );
arc( centre, StAngle, EndAngle, radius, NO_FILL, -1 );
break;
case FILLED:
arc( centre, StAngle, EndAngle, radius, NO_FILL, width );
break;
case SKETCH:
set_current_line_width( -1 );
arc( centre, StAngle, EndAngle,
radius - ( width - current_pen_width ) / 2, NO_FILL, -1 );
arc( centre, StAngle, EndAngle,
radius + ( width - current_pen_width ) / 2, NO_FILL, -1 );
break;
}
}
void PLOTTER::thick_rect( wxPoint p1, wxPoint p2, int width,
EDA_DRAW_MODE_T tracemode )
{
switch( tracemode )
{
case LINE:
rect( p1, p2, NO_FILL, -1 );
break;
case FILLED:
rect( p1, p2, NO_FILL, width );
break;
case SKETCH:
set_current_line_width( -1 );
p1.x -= (width - current_pen_width) / 2;
p1.y -= (width - current_pen_width) / 2;
p2.x += (width - current_pen_width) / 2;
p2.y += (width - current_pen_width) / 2;
rect( p1, p2, NO_FILL, -1 );
p1.x += (width - current_pen_width);
p1.y += (width - current_pen_width);
p2.x -= (width - current_pen_width);
p2.y -= (width - current_pen_width);
rect( p1, p2, NO_FILL, -1 );
break;
}
}
void PLOTTER::thick_circle( wxPoint pos, int diametre, int width,
void PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width,
EDA_DRAW_MODE_T tracemode )
{
switch( tracemode )
{
case LINE:
circle( pos, diametre, NO_FILL, -1 );
break;
case FILLED:
circle( pos, diametre, NO_FILL, width );
case LINE:
SetCurrentLineWidth( tracemode==FILLED ? width : -1 );
MoveTo( start );
FinishTo( end );
break;
case SKETCH:
set_current_line_width( -1 );
circle( pos, diametre - width + current_pen_width, NO_FILL, -1 );
circle( pos, diametre + width - current_pen_width, NO_FILL, -1 );
SetCurrentLineWidth( -1 );
segmentAsOval( start, end, width, tracemode );
break;
}
}
void PLOTTER::ThickArc( const wxPoint& centre, int StAngle, int EndAngle, int radius,
int width, EDA_DRAW_MODE_T tracemode )
{
switch( tracemode )
{
case LINE:
SetCurrentLineWidth( -1 );
Arc( centre, StAngle, EndAngle, radius, NO_FILL, -1 );
break;
case FILLED:
Arc( centre, StAngle, EndAngle, radius, NO_FILL, width );
break;
case SKETCH:
SetCurrentLineWidth( -1 );
Arc( centre, StAngle, EndAngle,
radius - ( width - currentPenWidth ) / 2, NO_FILL, -1 );
Arc( centre, StAngle, EndAngle,
radius + ( width - currentPenWidth ) / 2, NO_FILL, -1 );
break;
}
}
void PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
EDA_DRAW_MODE_T tracemode )
{
switch( tracemode )
{
case LINE:
Rect( p1, p2, NO_FILL, -1 );
break;
case FILLED:
Rect( p1, p2, NO_FILL, width );
break;
case SKETCH:
SetCurrentLineWidth( -1 );
wxPoint offsetp1( p1.x - (width - currentPenWidth) / 2,
p1.y - (width - currentPenWidth) / 2 );
wxPoint offsetp2( p2.x + (width - currentPenWidth) / 2,
p2.y + (width - currentPenWidth) / 2 );
Rect( offsetp1, offsetp2, NO_FILL, -1 );
offsetp1.x += (width - currentPenWidth);
offsetp1.y += (width - currentPenWidth);
offsetp2.x -= (width - currentPenWidth);
offsetp2.y -= (width - currentPenWidth);
Rect( offsetp1, offsetp2, NO_FILL, -1 );
break;
}
}
void PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width,
EDA_DRAW_MODE_T tracemode )
{
switch( tracemode )
{
case LINE:
Circle( pos, diametre, NO_FILL, -1 );
break;
case FILLED:
Circle( pos, diametre, NO_FILL, width );
break;
case SKETCH:
SetCurrentLineWidth( -1 );
Circle( pos, diametre - width + currentPenWidth, NO_FILL, -1 );
Circle( pos, diametre + width - currentPenWidth, NO_FILL, -1 );
break;
}
}
@ -424,10 +516,7 @@ void PLOTTER::thick_circle( wxPoint pos, int diametre, int width,
void PLOTTER::SetPageSettings( const PAGE_INFO& aPageSettings )
{
wxASSERT( !output_file );
wxASSERT( !outputFile );
pageInfo = aPageSettings;
// PAGE_INFO is in mils, plotter works with deci-mils
paper_size = pageInfo.GetSizeMils() * 10;
}

View File

@ -135,6 +135,21 @@ void SetLocaleTo_Default()
}
wxSize GetTextSize( const wxString& aSingleLine, wxWindow* aWindow )
{
wxCoord width;
wxCoord height;
{
wxClientDC dc( aWindow );
dc.SetFont( aWindow->GetFont() );
dc.GetTextExtent( aSingleLine, &width, &height );
}
return wxSize( width, height );
}
bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString )
{
wxWindow* window = aCtrl->GetParent();
@ -150,21 +165,13 @@ bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString )
aString = &ctrlText;
}
wxCoord width;
wxCoord height;
wxSize textz = GetTextSize( *aString, window );
wxSize ctrlz = aCtrl->GetSize();
if( ctrlz.GetWidth() < textz.GetWidth() + 10 )
{
wxClientDC dc( window );
dc.SetFont( aCtrl->GetFont() );
dc.GetTextExtent( *aString, &width, &height );
}
wxSize size = aCtrl->GetSize();
if( size.GetWidth() < width + 10 )
{
size.SetWidth( width + 10 );
aCtrl->SetSizeHints( size );
ctrlz.SetWidth( textz.GetWidth() + 10 );
aCtrl->SetSizeHints( ctrlz );
return true;
}
@ -318,10 +325,10 @@ bool ProcessExecute( const wxString& aCommandLine, int aFlags )
}
unsigned long GetNewTimeStamp()
time_t GetNewTimeStamp()
{
static unsigned long oldTimeStamp;
unsigned long newTimeStamp;
static time_t oldTimeStamp;
time_t newTimeStamp;
newTimeStamp = time( NULL );

View File

@ -12,252 +12,394 @@
#include <macros.h>
#include <kicad_string.h>
/* Set the plot offset for the current plotting
/**
* Oblique angle for DXF native text
* (I don't remember if 15 degrees is the ISO value... it looks nice anyway)
*/
void DXF_PLOTTER::set_viewport( wxPoint aOffset, double aScale, bool aMirror )
static const double DXF_OBLIQUE_ANGLE = 15;
/**
* Set the scale/position for the DXF plot
* The DXF engine doesn't support line widths and mirroring. The output
* coordinate system is in the first quadrant (in mm)
*/
void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
wxASSERT( !output_file );
plot_offset = aOffset;
plot_scale = aScale;
device_scale = 1;
set_default_line_width( 0 ); /* No line width on DXF */
plotMirror = false; /* No mirroring on DXF */
current_color = BLACK;
wxASSERT( !outputFile );
plotOffset = aOffset;
plotScale = aScale;
// XXX Need to think about this: what is the 'native' unit used for DXF?
iuPerDeviceUnit = 1.0 / aIusPerDecimil; // Gives a DXF in decimils
iuPerDeviceUnit *= 0.00254; // DXF in mm (I like it best)
// Compute the paper size in IUs
paperSize = pageInfo.GetSizeMils();
paperSize.x *= 10.0 * aIusPerDecimil;
paperSize.y *= 10.0 * aIusPerDecimil;
SetDefaultLineWidth( 0 ); // No line width on DXF
plotMirror = false; // No mirroring on DXF
currentColor = BLACK;
}
bool DXF_PLOTTER::start_plot( FILE* fout )
/**
* Opens the DXF plot with a skeleton header
*/
bool DXF_PLOTTER::StartPlot( FILE* fout )
{
wxASSERT( !output_file );
output_file = fout;
/* DXF HEADER - Boilerplate */
fputs( "0\nSECTION\n2\nHEADER\n9\n$ANGBASE\n50\n0.0\n9\n$ANGDIR\n70\n0\n0\nENDSEC\n0\nSECTION\n2\nTABLES\n0\nTABLE\n2\nLTYPE\n70\n1\n0\nLTYPE\n2\nCONTINUOUS\n70\n0\n3\nSolid line\n72\n65\n73\n0\n40\n0.0\n0\nENDTAB\n",
output_file );
/* Layer table - one layer per color */
fprintf( output_file, "0\nTABLE\n2\nLAYER\n70\n%d\n", NBCOLOR );
for( int i = 0; i<NBCOLOR; i++ )
wxASSERT( !outputFile );
outputFile = fout;
// DXF HEADER - Boilerplate
// Defines the minimum for drawing i.e. the angle system and the
// continuous linetype
fputs( " 0\n"
"SECTION\n"
" 2\n"
"HEADER\n"
" 9\n"
"$ANGBASE\n"
" 50\n"
"0.0\n"
" 9\n"
"$ANGDIR\n"
" 70\n"
"0\n"
" 0\n"
"ENDSEC\n"
" 0\n"
"SECTION\n"
" 2\n"
"TABLES\n"
" 0\n"
"TABLE\n"
" 2\n"
"LTYPE\n"
" 70\n"
"1\n"
" 0\n"
"LTYPE\n"
" 2\n"
"CONTINUOUS\n"
" 70\n"
"0\n"
" 3\n"
"Solid line\n"
" 72\n"
"65\n"
" 73\n"
"0\n"
" 40\n"
"0.0\n"
" 0\n"
"ENDTAB\n",
outputFile );
// Text styles table
// Defines 4 text styles, one for each bold/italic combination
fputs( " 0\n"
"TABLE\n"
" 2\n"
"STYLE\n"
" 70\n"
"4\n", outputFile );
static const char *style_name[4] = {"KICAD", "KICADB", "KICADI", "KICADBI"};
for(int i = 0; i < 4; i++ )
{
fprintf( outputFile,
" 0\n"
"STYLE\n"
" 2\n"
"%s\n" // Style name
" 70\n"
"0\n" // Standard flags
" 40\n"
"0\n" // Non-fixed height text
" 41\n"
"1\n" // Width factor (base)
" 42\n"
"1\n" // Last height (mandatory)
" 50\n"
"%g\n" // Oblique angle
" 71\n"
"0\n" // Generation flags (default)
" 3\n"
// The standard ISO font (when kicad is build with it
// the dxf text in acad matches *perfectly*)
"isocp.shx\n", // Font name (when not bigfont)
// Apply a 15 degree angle to italic text
style_name[i], i < 2 ? 0 : DXF_OBLIQUE_ANGLE );
}
// Layer table - one layer per color
fprintf( outputFile,
" 0\n"
"ENDTAB\n"
" 0\n"
"TABLE\n"
" 2\n"
"LAYER\n"
" 70\n"
"%d\n", NBCOLOR );
/* The layer/colors palette. The acad/DXF palette is divided in 3 zones:
- The primary colors (1 - 9)
- An HSV zone (10-250, 5 values x 2 saturations x 10 hues
- Greys (251 - 255)
The is *no* black... the white does it on paper, usually, and
anyway it depends on the plotter configuration, since DXF colors
are meant to be logical only (they represent *both* line color and
width); later version with plot styles only complicate the matter!
As usual, brown and magenta/purple are difficult to place since
they are actually variations of other colors.
*/
static const struct {
const char *name;
int color;
} dxf_layer[NBCOLOR] = {
{ "Black", 250 },
{ "Blue", 5 },
{ "Green", 3 },
{ "Cyan", 4 },
{ "Red", 1 },
{ "Magenta", 6 },
{ "Brown", 54 },
{ "LightGray", 9 },
{ "DarkGray", 8 },
{ "LightBlue", 171 },
{ "LightGreen", 91 },
{ "LightCyan", 131 },
{ "LightRed", 11 },
{ "LightMagenta", 221 },
{ "Yellow", 2 },
{ "White", 7 },
{ "DarkDarkGray", 251 },
{ "DarkBlue", 178 },
{ "DarkGreen", 98 },
{ "DarkCyan", 138 },
{ "DarkRed", 18 },
{ "DarkMagenta", 228 },
{ "DarkBrown", 58 },
{ "LightYellow", 51 },
};
for( int i = 0; i < NBCOLOR; i++ )
{
wxString cname = ColorRefs[i].m_Name;
fprintf( output_file, "0\nLAYER\n2\n%s\n70\n0\n62\n%d\n6\nCONTINUOUS\n",
TO_UTF8( cname ), i + 1 );
fprintf( outputFile,
" 0\n"
"LAYER\n"
" 2\n"
"%s\n" // Layer name
" 70\n"
"0\n" // Standard flags
" 62\n"
"%d\n" // Color number
" 6\n"
"CONTINUOUS\n",// Linetype name
dxf_layer[i].name, dxf_layer[i].color );
}
/* End of layer table, begin entities */
fputs( "0\nENDTAB\n0\nENDSEC\n0\nSECTION\n2\nENTITIES\n", output_file );
// End of layer table, begin entities
fputs( " 0\n"
"ENDTAB\n"
" 0\n"
"ENDSEC\n"
" 0\n"
"SECTION\n"
" 2\n"
"ENTITIES\n", outputFile );
return true;
}
bool DXF_PLOTTER::end_plot()
bool DXF_PLOTTER::EndPlot()
{
wxASSERT( output_file );
/* DXF FOOTER */
fputs( "0\nENDSEC\n0\nEOF\n", output_file );
fclose( output_file );
output_file = NULL;
wxASSERT( outputFile );
// DXF FOOTER
fputs( " 0\n"
"ENDSEC\n"
" 0\n"
"EOF\n", outputFile );
fclose( outputFile );
outputFile = NULL;
return true;
}
/*
* color = color index in ColorRefs[]
*/
void DXF_PLOTTER::set_color( int color )
{
wxASSERT( output_file );
if( ( color >= 0 && color_mode )
|| ( color == BLACK )
|| ( color == WHITE ) )
{
current_color = color;
}
}
void DXF_PLOTTER::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width )
{
wxASSERT( output_file );
move_to( p1 );
line_to( wxPoint( p1.x, p2.y ) );
line_to( wxPoint( p2.x, p2.y ) );
line_to( wxPoint( p2.x, p1.y ) );
finish_to( wxPoint( p1.x, p1.y ) );
}
void DXF_PLOTTER::circle( wxPoint centre, int diameter, FILL_T fill, int width )
{
wxASSERT( output_file );
double radius = user_to_device_size( diameter / 2 );
user_to_device_coordinates( centre );
if( radius > 0 )
{
wxString cname = ColorRefs[current_color].m_Name;
if (!fill) {
fprintf( output_file, "0\nCIRCLE\n8\n%s\n10\n%d.0\n20\n%d.0\n40\n%g\n",
TO_UTF8( cname ),
centre.x, centre.y, radius );
}
if (fill == FILLED_SHAPE) {
int r = (int)(radius*0.5);
fprintf( output_file, "0\nPOLYLINE\n");
fprintf( output_file, "8\n%s\n66\n1\n70\n1\n", TO_UTF8( cname ));
fprintf( output_file, "40\n%g\n41\n%g\n", radius,radius);
fprintf( output_file, "0\nVERTEX\n8\n%s\n", TO_UTF8( cname ));
fprintf( output_file, "10\n%d.0\n 20\n%d.0\n42\n1.0\n", centre.x-r,centre.y);
fprintf( output_file, "0\nVERTEX\n8\n%s\n", TO_UTF8( cname ));
fprintf( output_file, "10\n%d.0\n 20\n%d.0\n42\n1.0\n", centre.x+r,centre.y);
fprintf( output_file, "0\nSEQEND\n");
}
}
}
/* Draw a polygon (closed if filled) in DXF format
* nb = number of coord (coord 1 = 2 elements: X and Y table)
* aFill: if != 0 filled polygon
*/
void DXF_PLOTTER::PlotPoly( std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth)
{
if( aCornerList.size() <= 1 )
return;
move_to( aCornerList[0] );
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
line_to( aCornerList[ii] );
/* Close polygon. */
if( aFill )
{
unsigned ii = aCornerList.size() - 1;
if( aCornerList[ii] != aCornerList[0] )
line_to( aCornerList[0] );
}
pen_finish();
}
/*
* Function PlotImage
* Only Postscript plotters can plot bitmaps
* for plotters that cannot plot a bitmap, a rectangle is plotted
* For DXF_PLOTTER, currently: draws a rectangle
* param aImage = the bitmap
* param aPos = position of the center of the bitmap
* param aScaleFactor = the scale factor to apply to the bitmap size
* (this is not the plot scale factor)
*/
void DXF_PLOTTER::PlotImage( wxImage & aImage, wxPoint aPos, double aScaleFactor )
{
wxSize size;
size.x = aImage.GetWidth();
size.y = aImage.GetHeight();
size.x = KiROUND( size.x * aScaleFactor );
size.y = KiROUND( size.y * aScaleFactor );
wxPoint start = aPos;
start.x -= size.x / 2;
start.y -= size.y / 2;
wxPoint end = start;
end.x += size.x;
end.y += size.y;
rect( start, end, NO_FILL );
}
/*
* Move the pen up (pen = 'U') or down (feather = 'D') at position x, y
* Unit to unit DRAWING
* If pen = 'Z' without lifting pen displacement
*/
void DXF_PLOTTER::pen_to( wxPoint pos, char plume )
{
wxASSERT( output_file );
if( plume == 'Z' )
{
return;
}
user_to_device_coordinates( pos );
if( pen_lastpos != pos && plume == 'D' )
{
/* DXF LINE */
wxString cname = ColorRefs[current_color].m_Name;
fprintf( output_file, "0\nLINE\n8\n%s\n10\n%d.0\n20\n%d.0\n11\n%d.0\n21\n%d.0\n",
TO_UTF8( cname ),
pen_lastpos.x, pen_lastpos.y, pos.x, pos.y );
}
pen_lastpos = pos;
}
void DXF_PLOTTER::set_dash( bool dashed )
{
/* NOP for now */
}
/**
* Function thick_segment
* Plot a filled segment (track)
* @param aStart = starting point
* @param aEnd = ending point
* @param aWidth = segment width (thickness)
* @param aPlotMode = FILLED, SKETCH ..
* The DXF exporter handles 'colors' as layers...
*/
void DXF_PLOTTER::thick_segment( wxPoint aStart, wxPoint aEnd, int aWidth,
EDA_DRAW_MODE_T aPlotMode )
void DXF_PLOTTER::SetColor( EDA_COLOR_T color )
{
if( aPlotMode == LINE ) /* just a line is Ok */
wxASSERT( outputFile );
if( ( color >= 0 && colorMode )
|| ( color == BLACK )
|| ( color == WHITE ) )
{
move_to( aStart );
finish_to( aEnd );
currentColor = color;
}
else
}
/**
* DXF rectangle: fill not supported
*/
void DXF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width )
{
wxASSERT( outputFile );
MoveTo( p1 );
LineTo( wxPoint( p1.x, p2.y ) );
LineTo( wxPoint( p2.x, p2.y ) );
LineTo( wxPoint( p2.x, p1.y ) );
FinishTo( wxPoint( p1.x, p1.y ) );
}
/**
* DXF circle: full functionality; it even does 'fills' drawing a
* circle with a dual-arc polyline wide as the radius.
*
* I could use this trick to do other filled primitives
*/
void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int width )
{
wxASSERT( outputFile );
double radius = userToDeviceSize( diameter / 2 );
DPOINT centre_dev = userToDeviceCoordinates( centre );
if( radius > 0 )
{
segment_as_oval( aStart, aEnd, aWidth, aPlotMode );
wxString cname = ColorRefs[currentColor].m_Name;
if (!fill)
{
fprintf( outputFile, "0\nCIRCLE\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n",
TO_UTF8( cname ),
centre_dev.x, centre_dev.y, radius );
}
if (fill == FILLED_SHAPE)
{
double r = radius*0.5;
fprintf( outputFile, "0\nPOLYLINE\n");
fprintf( outputFile, "8\n%s\n66\n1\n70\n1\n", TO_UTF8( cname ));
fprintf( outputFile, "40\n%g\n41\n%g\n", radius, radius);
fprintf( outputFile, "0\nVERTEX\n8\n%s\n", TO_UTF8( cname ));
fprintf( outputFile, "10\n%g\n 20\n%g\n42\n1.0\n",
centre_dev.x-r, centre_dev.y );
fprintf( outputFile, "0\nVERTEX\n8\n%s\n", TO_UTF8( cname ));
fprintf( outputFile, "10\n%g\n 20\n%g\n42\n1.0\n",
centre_dev.x+r, centre_dev.y );
fprintf( outputFile, "0\nSEQEND\n");
}
}
}
/* Plot an arc in DXF format.
* center = center coord
* StAngle, EndAngle = angle of beginning and end
* Radius = radius of the arc
/**
* DXF polygon: doesn't fill it but at least it close the filled ones
*/
void DXF_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int radius,
void DXF_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth)
{
if( aCornerList.size() <= 1 )
return;
MoveTo( aCornerList[0] );
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
LineTo( aCornerList[ii] );
// Close polygon if 'fill' requested
if( aFill )
{
unsigned ii = aCornerList.size() - 1;
if( aCornerList[ii] != aCornerList[0] )
LineTo( aCornerList[0] );
}
PenFinish();
}
void DXF_PLOTTER::PenTo( const wxPoint& pos, char plume )
{
wxASSERT( outputFile );
if( plume == 'Z' )
{
return;
}
DPOINT pos_dev = userToDeviceCoordinates( pos );
DPOINT pen_lastpos_dev = userToDeviceCoordinates( penLastpos );
if( penLastpos != pos && plume == 'D' )
{
// DXF LINE
wxString cname = ColorRefs[currentColor].m_Name;
fprintf( outputFile, "0\nLINE\n8\n%s\n10\n%g\n20\n%g\n11\n%g\n21\n%g\n",
TO_UTF8( cname ),
pen_lastpos_dev.x, pen_lastpos_dev.y, pos_dev.x, pos_dev.y );
}
penLastpos = pos;
}
/**
* Dashed lines are not (yet) supported by DXF_PLOTTER
*/
void DXF_PLOTTER::SetDash( bool dashed )
{
// NOP for now
}
void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int aWidth,
EDA_DRAW_MODE_T aPlotMode )
{
if( aPlotMode == LINE ) // In line mode, just a line is OK
{
MoveTo( aStart );
FinishTo( aEnd );
}
else
{
segmentAsOval( aStart, aEnd, aWidth, aPlotMode );
}
}
/** Plot an arc in DXF format
* Filling is not supported
*/
void DXF_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius,
FILL_T fill, int width )
{
wxASSERT( output_file );
wxASSERT( outputFile );
if( radius <= 0 )
return;
user_to_device_coordinates( centre );
radius = KiROUND( user_to_device_size( radius ) );
DPOINT centre_dev = userToDeviceCoordinates( centre );
double radius_dev = userToDeviceSize( radius );
/* DXF ARC */
wxString cname = ColorRefs[current_color].m_Name;
fprintf( output_file,
"0\nARC\n8\n%s\n10\n%d.0\n20\n%d.0\n40\n%d.0\n50\n%d.0\n51\n%d.0\n",
// Emit a DXF ARC entity
wxString cname = ColorRefs[currentColor].m_Name;
fprintf( outputFile,
"0\nARC\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n50\n%g\n51\n%g\n",
TO_UTF8( cname ),
centre.x, centre.y, radius,
StAngle / 10, EndAngle / 10 );
centre_dev.x, centre_dev.y, radius_dev,
StAngle / 10.0, EndAngle / 10.0 );
}
/* Plot oval pad at position. */
void DXF_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
EDA_DRAW_MODE_T trace_mode )
/**
* DXF oval pad: always done in sketch mode
*/
void DXF_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int orient,
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
wxASSERT( outputFile );
wxSize size( aSize );
/* The chip is reduced to an oval tablet with size.y > size.x
* (Oval vertical orientation 0) */
@ -268,37 +410,41 @@ void DXF_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
if( orient >= 3600 )
orient -= 3600;
}
sketch_oval( pos, size, orient, -1 );
sketchOval( pos, size, orient, -1 );
}
/* Plot round pad or via. */
void DXF_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
/**
* DXF round pad: always done in sketch mode; it could be filled but it isn't
* pretty if other kinds of pad aren't...
*/
void DXF_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
circle( pos, diametre, NO_FILL );
wxASSERT( outputFile );
Circle( pos, diametre, NO_FILL );
}
/*
* Plot rectangular pad vertical or horizontal (rectangular Pad)
/**
* DXF rectangular pad: alwayd done in sketch mode
*/
void DXF_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
int orient, EDA_DRAW_MODE_T trace_mode )
void DXF_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
int orient, EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
wxASSERT( outputFile );
wxSize size;
int ox, oy, fx, fy;
size.x = padsize.x / 2; size.y = padsize.y / 2;
size.x = padsize.x / 2;
size.y = padsize.y / 2;
if( size.x < 0 )
size.x = 0;
if( size.y < 0 )
size.y = 0;
/* If a dimension is zero, the trace is reduced to 1 line. */
// If a dimension is zero, the trace is reduced to 1 line
if( size.x == 0 )
{
ox = pos.x;
@ -307,8 +453,8 @@ void DXF_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
fx = pos.x;
fy = pos.y + size.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
move_to( wxPoint( ox, oy ) );
finish_to( wxPoint( fx, fy ) );
MoveTo( wxPoint( ox, oy ) );
FinishTo( wxPoint( fx, fy ) );
return;
}
if( size.y == 0 )
@ -319,45 +465,42 @@ void DXF_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
fx = pos.x + size.x;
fy = pos.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
move_to( wxPoint( ox, oy ) );
finish_to( wxPoint( fx, fy ) );
MoveTo( wxPoint( ox, oy ) );
FinishTo( wxPoint( fx, fy ) );
return;
}
ox = pos.x - size.x;
oy = pos.y - size.y;
RotatePoint( &ox, &oy, pos.x, pos.y, orient );
move_to( wxPoint( ox, oy ) );
MoveTo( wxPoint( ox, oy ) );
fx = pos.x - size.x;
fy = pos.y + size.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
line_to( wxPoint( fx, fy ) );
LineTo( wxPoint( fx, fy ) );
fx = pos.x + size.x;
fy = pos.y + size.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
line_to( wxPoint( fx, fy ) );
LineTo( wxPoint( fx, fy ) );
fx = pos.x + size.x;
fy = pos.y - size.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
line_to( wxPoint( fx, fy ) );
LineTo( wxPoint( fx, fy ) );
finish_to( wxPoint( ox, oy ) );
FinishTo( wxPoint( ox, oy ) );
}
/*
* Plot trapezoidal pad.
* aPadPos is pad position, aCorners the corners position of the basic shape
* Orientation aPadOrient in 0.1 degrees
* Plot mode = FILLED, SKETCH (unused)
/**
* DXF trapezoidal pad: only sketch mode is supported
*/
void DXF_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
void DXF_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
{
wxASSERT( output_file );
wxASSERT( outputFile );
wxPoint coord[4]; /* coord actual corners of a trapezoidal trace */
for( int ii = 0; ii < 4; ii++ )
@ -368,9 +511,158 @@ void DXF_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
}
// Plot edge:
move_to( coord[0] );
line_to( coord[1] );
line_to( coord[2] );
line_to( coord[3] );
finish_to( coord[0] );
MoveTo( coord[0] );
LineTo( coord[1] );
LineTo( coord[2] );
LineTo( coord[3] );
FinishTo( coord[0] );
}
void DXF_PLOTTER::Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
int aWidth,
bool aItalic,
bool aBold )
{
if( textAsLines )
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
aWidth, aItalic, aBold );
else
{
/* Emit text as a text entity. This loses formatting and shape but it's
more useful as a CAD object */
DPOINT origin_dev = userToDeviceCoordinates( aPos );
if( aColor >= 0 )
currentColor = aColor;
wxString cname = ColorRefs[currentColor].m_Name;
DPOINT size_dev = userToDeviceSize( aSize );
int h_code = 0, v_code = 0;
switch( aH_justify )
{
case GR_TEXT_HJUSTIFY_LEFT:
h_code = 0;
break;
case GR_TEXT_HJUSTIFY_CENTER:
h_code = 1;
break;
case GR_TEXT_HJUSTIFY_RIGHT:
h_code = 2;
break;
}
switch( aV_justify )
{
case GR_TEXT_VJUSTIFY_TOP:
v_code = 3;
break;
case GR_TEXT_VJUSTIFY_CENTER:
v_code = 2;
break;
case GR_TEXT_VJUSTIFY_BOTTOM:
v_code = 1;
break;
}
// Position, size, rotation and alignment
// The two alignment point usages is somewhat idiot (see the DXF ref)
// Anyway since we don't use the fit/aligned options, they're the same
fprintf( outputFile,
" 0\n"
"TEXT\n"
" 7\n"
"%s\n" // Text style
" 8\n"
"%s\n" // Layer name
" 10\n"
"%g\n" // First point X
" 11\n"
"%g\n" // Second point X
" 20\n"
"%g\n" // First point Y
" 21\n"
"%g\n" // Second point Y
" 40\n"
"%g\n" // Text height
" 41\n"
"%g\n" // Width factor
" 50\n"
"%g\n" // Rotation
" 51\n"
"%g\n" // Oblique angle
" 71\n"
"%d\n" // Mirror flags
" 72\n"
"%d\n" // H alignment
" 73\n"
"%d\n", // V alignment
aBold ? (aItalic ? "KICADBI" : "KICADB")
: (aItalic ? "KICADI" : "KICAD"),
TO_UTF8( cname ),
origin_dev.x, origin_dev.x,
origin_dev.y, origin_dev.y,
size_dev.y, fabs( size_dev.y / size_dev.x ),
aOrient / 10.0,
aItalic ? DXF_OBLIQUE_ANGLE : 0,
size_dev.x < 0 ? 2 : 0, // X mirror flag
h_code, v_code );
/* There are two issue in emitting the text:
- Our overline character (~) must be converted to the appropriate
control sequence %%O or %%o
- Text encoding in DXF is more or less unspecified since depends on
the DXF declared version, the acad version reading it *and* some
system variables to be put in the header handled only by newer acads
Also before R15 unicode simply is not supported (you need to use
bigfonts which are a massive PITA). Common denominator solution:
use Latin1 (and however someone could choke on it, anyway). Sorry
for the extended latin people. If somewant want to try fixing this
recent version seems to use UTF-8 (and not UCS2 like the rest of
Windows)
XXX Actually there is a *third* issue: older DXF formats are limited
to 255 bytes records (it was later raised to 2048); since I'm lazy
and text so long is not probable I just don't implement this rule.
If someone is interested in fixing this, you have to emit the first
partial lines with group code 3 (max 250 bytes each) and then finish
with a group code 1 (less than 250 bytes). The DXF refs explains it
in no more details...
*/
bool overlining = false;
fputs( " 1\n", outputFile );
for( unsigned i = 0; i < aText.length(); i++ )
{
/* Here I do a bad thing: writing the output one byte at a time!
but today I'm lazy and I have no idea on how to coerce a Unicode
wxString to spit out latin1 encoded text ...
Atleast stdio is *supposed* to do output buffering, so there is
hope is not too slow */
wchar_t ch = aText[i];
if( ch > 255 )
{
// I can't encode this...
putc( '?', outputFile );
}
else
{
if( ch == '~' )
{
// Handle the overline toggle
fputs( overlining ? "%%o" : "%%O", outputFile );
overlining = !overlining;
}
else
{
putc( ch, outputFile );
}
}
}
putc( '\n', outputFile );
}
}

View File

@ -16,25 +16,34 @@
#include <build_version.h>
/**
* Function set_viewport
* Set the plot offset for the current plotting
* @param aOffset = plot offset
* @param aScale = coordinate scale (scale coefficient for coordinates)
* @param aMirror - Mirror plot if true.
*/
void GERBER_PLOTTER::set_viewport( wxPoint aOffset, double aScale, bool aMirror )
void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
wxASSERT( !output_file );
wxASSERT( !outputFile );
wxASSERT( aMirror == false );
plotMirror = false;
plot_offset = aOffset;
plotOffset = aOffset;
wxASSERT( aScale == 1 );
plot_scale = 1;
device_scale = 1;
set_default_line_width( 100 ); /* line thickness in 1 / 1000 inch */
plotScale = 1;
iuPerDeviceUnit = 1.0 / aIusPerDecimil;
/* We don't handle the filmbox, and it's more useful to keep the
* origin at the origin */
paperSize.x = 0;
paperSize.y = 0;
SetDefaultLineWidth( 100 * aIusPerDecimil ); // Arbitrary default
}
/**
* Emit a D-Code record, using proper conversions
* to format a leading zero omitted gerber coordinate
* (for 4 decimal positions, see header generation in start_plot
*/
void GERBER_PLOTTER::emitDcode( const DPOINT& pt, int dcode )
{
fprintf( outputFile, "X%dY%dD%02d*\n",
int( pt.x ), int( pt.y ), dcode );
}
/**
* Function start_plot
@ -42,106 +51,102 @@ void GERBER_PLOTTER::set_viewport( wxPoint aOffset, double aScale, bool aMirror
* initialize global variable g_Plot_PlotOutputFile
* @param aFile: an opened file to write to
*/
bool GERBER_PLOTTER::start_plot( FILE* aFile )
bool GERBER_PLOTTER::StartPlot( FILE* aFile )
{
wxASSERT( !output_file );
final_file = aFile;
wxASSERT( !outputFile );
finalFile = aFile;
// Create a temporary filename to store gerber file
// note tmpfile() does not work under Vista and W7 in user mode
m_workFilename = filename + wxT(".tmp");
work_file = wxFopen( m_workFilename, wxT( "wt" ));
output_file = work_file;
wxASSERT( output_file );
workFile = wxFopen( m_workFilename, wxT( "wt" ));
outputFile = workFile;
wxASSERT( outputFile );
if( output_file == NULL )
if( outputFile == NULL )
return false;
wxString Title = creator + wxT( " " ) + GetBuildVersion();
fprintf( output_file, "G04 (created by %s) date %s*\n",
fprintf( outputFile, "G04 (created by %s) date %s*\n",
TO_UTF8( Title ), TO_UTF8( DateAndTime() ) );
// Specify linear interpol (G01), unit = INCH (G70), abs format (G90):
fputs( "G01*\nG70*\nG90*\n", output_file );
fputs( "%MOIN*%\n", output_file ); // set unites = INCHES
/* Mass parameter: unit = INCHES */
fputs( "%MOIN*%\n", outputFile );
/* Set gerber format to 3.4 */
/* Set coordinate format to 3.4 absolute, leading zero omitted */
fputs( "G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*\n%FSLAX34Y34*%\n",
output_file );
outputFile );
fputs( "G04 APERTURE LIST*\n", output_file );
/* Specify linear interpol (G01), unit = INCH (G70), abs format (G90) */
fputs( "G01*\nG70*\nG90*\n", outputFile );
fputs( "G04 APERTURE LIST*\n", outputFile );
/* Select the default aperture */
set_current_line_width( -1 );
SetCurrentLineWidth( -1 );
return true;
}
bool GERBER_PLOTTER::end_plot()
bool GERBER_PLOTTER::EndPlot()
{
char line[1024];
wxString msg;
wxASSERT( output_file );
wxASSERT( outputFile );
/* Outfile is actually a temporary file! */
fputs( "M02*\n", output_file );
fflush( output_file );
/* Outfile is actually a temporary file i.e. workFile */
fputs( "M02*\n", outputFile );
fflush( outputFile );
// rewind( work_file ); // work_file == output_file !!!
fclose( work_file );
work_file = wxFopen( m_workFilename, wxT( "rt" ));
wxASSERT( work_file );
output_file = final_file;
fclose( workFile );
workFile = wxFopen( m_workFilename, wxT( "rt" ));
wxASSERT( workFile );
outputFile = finalFile;
// Placement of apertures in RS274X
while( fgets( line, 1024, work_file ) )
while( fgets( line, 1024, workFile ) )
{
fputs( line, output_file );
fputs( line, outputFile );
if( strcmp( strtok( line, "\n\r" ), "G04 APERTURE LIST*" ) == 0 )
{
write_aperture_list();
fputs( "G04 APERTURE END LIST*\n", output_file );
writeApertureList();
fputs( "G04 APERTURE END LIST*\n", outputFile );
}
}
fclose( work_file );
fclose( final_file );
fclose( workFile );
fclose( finalFile );
::wxRemoveFile( m_workFilename );
output_file = 0;
outputFile = 0;
return true;
}
/* Set the default line width (in 1/1000 inch) for the current plotting
*/
void GERBER_PLOTTER::set_default_line_width( int width )
void GERBER_PLOTTER::SetDefaultLineWidth( int width )
{
default_pen_width = width;
current_aperture = apertures.end();
defaultPenWidth = width;
currentAperture = apertures.end();
}
/* Set the Current line width (in 1/1000 inch) for the next plot
*/
void GERBER_PLOTTER::set_current_line_width( int width )
void GERBER_PLOTTER::SetCurrentLineWidth( int width )
{
int pen_width;
if( width > 0 )
pen_width = width;
else
pen_width = default_pen_width;
pen_width = defaultPenWidth;
select_aperture( wxSize( pen_width, pen_width ), APERTURE::Plotting );
current_pen_width = pen_width;
selectAperture( wxSize( pen_width, pen_width ), APERTURE::Plotting );
currentPenWidth = pen_width;
}
std::vector<APERTURE>::iterator GERBER_PLOTTER::get_aperture( const wxSize& size,
APERTURE::Aperture_Type type )
std::vector<APERTURE>::iterator GERBER_PLOTTER::getAperture( const wxSize& size,
APERTURE::APERTURE_TYPE type )
{
int last_D_code = 9;
@ -150,9 +155,9 @@ std::vector<APERTURE>::iterator GERBER_PLOTTER::get_aperture( const wxSize&
while( tool != apertures.end() )
{
last_D_code = tool->D_code;
last_D_code = tool->DCode;
if( (tool->type == type) && (tool->size == size) )
if( (tool->Type == type) && (tool->Size == size) )
return tool;
tool++;
@ -160,76 +165,78 @@ std::vector<APERTURE>::iterator GERBER_PLOTTER::get_aperture( const wxSize&
// Allocate a new aperture
APERTURE new_tool;
new_tool.size = size;
new_tool.type = type;
new_tool.D_code = last_D_code + 1;
new_tool.Size = size;
new_tool.Type = type;
new_tool.DCode = last_D_code + 1;
apertures.push_back( new_tool );
return apertures.end() - 1;
}
void GERBER_PLOTTER::select_aperture( const wxSize& size,
APERTURE::Aperture_Type type )
void GERBER_PLOTTER::selectAperture( const wxSize& size,
APERTURE::APERTURE_TYPE type )
{
wxASSERT( output_file );
wxASSERT( outputFile );
if( ( current_aperture == apertures.end() )
|| ( current_aperture->type != type )
|| ( current_aperture->size != size ) )
if( ( currentAperture == apertures.end() )
|| ( currentAperture->Type != type )
|| ( currentAperture->Size != size ) )
{
/* Pick an existing aperture or create a new one */
current_aperture = get_aperture( size, type );
fprintf( output_file, "G54D%d*\n", current_aperture->D_code );
currentAperture = getAperture( size, type );
fprintf( outputFile, "G54D%d*\n", currentAperture->DCode );
}
}
/*Generate list of D_CODES.
* Returns the number of D_Codes generated in RS274X format.
/**
* Generate the table of D codes
*/
void GERBER_PLOTTER::write_aperture_list()
void GERBER_PLOTTER::writeApertureList()
{
wxASSERT( output_file );
wxASSERT( outputFile );
char cbuf[1024];
/* Init : */
for( std::vector<APERTURE>::iterator tool = apertures.begin();
tool != apertures.end(); tool++ )
{
const float fscale = 0.0001f * plot_scale; // For 3.4 format
char* text;
const double fscale = 0.0001f * plotScale
* iuPerDeviceUnit ; // For 3.4 format
char* text = cbuf + sprintf( cbuf, "%%ADD%d", tool->DCode );
text = cbuf + sprintf( cbuf, "%%ADD%d", tool->D_code );
switch( tool->type )
switch( tool->Type )
{
case APERTURE::Circle:
sprintf( text, "C,%f*%%\n", tool->size.x * fscale );
sprintf( text, "C,%g*%%\n", tool->Size.x * fscale );
break;
case APERTURE::Rect:
sprintf( text, "R,%fX%f*%%\n", tool->size.x * fscale,
tool->size.y * fscale );
sprintf( text, "R,%gX%g*%%\n",
tool->Size.x * fscale,
tool->Size.y * fscale );
break;
case APERTURE::Plotting:
sprintf( text, "C,%f*%%\n", tool->size.x * fscale );
sprintf( text, "C,%g*%%\n", tool->Size.x * fscale );
break;
case APERTURE::Oval:
sprintf( text, "O,%fX%f*%%\n", tool->size.x * fscale, tool->size.y * fscale );
sprintf( text, "O,%gX%g*%%\n",
tool->Size.x * fscale,
tool->Size.y * fscale );
break;
}
fputs( cbuf, output_file );
fputs( cbuf, outputFile );
}
}
void GERBER_PLOTTER::pen_to( wxPoint aPos, char plume )
void GERBER_PLOTTER::PenTo( const wxPoint& aPos, char plume )
{
wxASSERT( output_file );
user_to_device_coordinates( aPos );
wxASSERT( outputFile );
DPOINT pos_dev = userToDeviceCoordinates( aPos );
switch( plume )
{
@ -237,21 +244,21 @@ void GERBER_PLOTTER::pen_to( wxPoint aPos, char plume )
break;
case 'U':
fprintf( output_file, "X%5.5dY%5.5dD02*\n", aPos.x, aPos.y );
emitDcode( pos_dev, 2 );
break;
case 'D':
fprintf( output_file, "X%5.5dY%5.5dD01*\n", aPos.x, aPos.y );
emitDcode( pos_dev, 1 );
}
pen_state = plume;
penState = plume;
}
void GERBER_PLOTTER::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width )
void GERBER_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
int width )
{
static std::vector< wxPoint > cornerList;
cornerList.clear();
std::vector< wxPoint > cornerList;
// Build corners list
cornerList.push_back( p1 );
@ -267,141 +274,98 @@ void GERBER_PLOTTER::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width )
}
/**
* Function circle
* writes a non filled circle to output file
* Plot one circle as segments (6 to 16 depending on its radius
* @param aCentre = center coordinates
* @param aDiameter = diameter of the circle
* @param aFill = plot option (NO_FILL, FILLED_SHAPE, FILLED_WITH_BG_BODYCOLOR)
* not used here: circles are always not filled the gerber. Filled circles are flashed
* @param aWidth = line width
*/
void GERBER_PLOTTER::circle( wxPoint aCentre, int aDiameter, FILL_T aFill, int aWidth )
void GERBER_PLOTTER::Circle( const wxPoint& aCentre, int aDiameter, FILL_T aFill,
int aWidth )
{
wxASSERT( output_file );
wxASSERT( outputFile );
wxPoint start, end;
double radius = aDiameter / 2;
const int delta = 3600 / 32; /* increment (in 0.1 degrees) to draw circles */
start.x = aCentre.x + KiROUND( radius );
start.y = aCentre.y;
set_current_line_width( aWidth );
move_to( start );
SetCurrentLineWidth( aWidth );
MoveTo( start );
for( int ii = delta; ii < 3600; ii += delta )
{
end.x = aCentre.x + (int) ( radius * cos( DEG2RAD( (double)ii / 10.0 ) ) );
end.y = aCentre.y + (int) ( radius * sin( DEG2RAD( (double)ii / 10.0 ) ) );
line_to( end );
end.x = aCentre.x + (int) ( radius * cos( DEG2RAD( ii / 10.0 ) ) );
end.y = aCentre.y + (int) ( radius * sin( DEG2RAD( ii / 10.0 ) ) );
LineTo( end );
}
finish_to( start );
FinishTo( start );
}
/*
* Function PlotPoly
* writes a filled or not filled polyline to output file
* @param aCornerList = buffer of corners coordinates
* @param aFill = plot option (NO_FILL, FILLED_SHAPE, FILLED_WITH_BG_BODYCOLOR)
* @param aWidth = Width of the line to plot.
/**
* Gerber polygon: they can (and *should*) be filled with the
* appropriate G36/G37 sequence (raster fills are deprecated)
*/
void GERBER_PLOTTER::PlotPoly( std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth )
void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth )
{
if( aCornerList.size() <= 1 )
return;
set_current_line_width( aWidth );
SetCurrentLineWidth( aWidth );
if( aFill )
fputs( "G36*\n", output_file );
fputs( "G36*\n", outputFile );
move_to( aCornerList[0] );
MoveTo( aCornerList[0] );
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
{
line_to( aCornerList[ii] );
LineTo( aCornerList[ii] );
}
if( aFill )
{
finish_to( aCornerList[0] );
fputs( "G37*\n", output_file );
FinishTo( aCornerList[0] );
fputs( "G37*\n", outputFile );
}
else
{
pen_finish();
PenFinish();
}
}
/*
* Function PlotImage
* Only Postscript plotters can plot bitmaps
* for plotters that cannot plot a bitmap, a rectangle is plotted
* For GERBER_PLOTTER, draws a rectangle
* param aImage = the bitmap
* param aPos = position of the center of the bitmap
* param aScaleFactor = the scale factor to apply to the bitmap size
* (this is not the plot scale factor)
/**
* Filled circular flashes are stored as apertures
*/
void GERBER_PLOTTER::PlotImage( wxImage & aImage, wxPoint aPos, double aScaleFactor )
void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
EDA_DRAW_MODE_T trace_mode )
{
wxSize size;
size.x = aImage.GetWidth();
size.y = aImage.GetHeight();
size.x = KiROUND( size.x * aScaleFactor );
size.y = KiROUND( size.y * aScaleFactor );
wxPoint start = aPos;
start.x -= size.x / 2;
start.y -= size.y / 2;
wxPoint end = start;
end.x += size.x;
end.y += size.y;
rect( start, end, NO_FILL );
}
/* Function flash_pad_circle
* Plot a circular pad or via at the user position pos
*/
void GERBER_PLOTTER::flash_pad_circle( wxPoint pos, int diametre, EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
wxASSERT( outputFile );
wxSize size( diametre, diametre );
switch( trace_mode )
{
case LINE:
case SKETCH:
set_current_line_width( -1 );
circle( pos, diametre - current_pen_width, NO_FILL );
SetCurrentLineWidth( -1 );
Circle( pos, diametre - currentPenWidth, NO_FILL );
break;
case FILLED:
user_to_device_coordinates( pos );
select_aperture( size, APERTURE::Circle );
fprintf( output_file, "X%5.5dY%5.5dD03*\n", pos.x, pos.y );
DPOINT pos_dev = userToDeviceCoordinates( pos );
selectAperture( size, APERTURE::Circle );
emitDcode( pos_dev, 3 );
break;
}
}
/* Plot oval pad at position pos:
* Dimensions dx, dy,
* Orient Orient
* For a vertical or horizontal orientation, the shape is flashed
* For any orientation the shape is drawn as a segment
/**
* Filled oval flashes are handled as aperture in the 90 degree positions only
*/
void GERBER_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
EDA_DRAW_MODE_T trace_mode )
void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int orient,
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
wxASSERT( outputFile );
int x0, y0, x1, y1, delta;
wxSize size( aSize );
/* Plot a flashed shape. */
if( ( orient == 0 || orient == 900 || orient == 1800 || orient == 2700 )
@ -409,10 +373,10 @@ void GERBER_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
{
if( orient == 900 || orient == 2700 ) /* orientation turned 90 deg. */
EXCHG( size.x, size.y );
user_to_device_coordinates( pos );
select_aperture( size, APERTURE::Oval );
fprintf( output_file, "X%5.5dY%5.5dD03*\n", pos.x, pos.y );
DPOINT pos_dev = userToDeviceCoordinates( pos );
selectAperture( size, APERTURE::Oval );
emitDcode( pos_dev, 3 );
}
else /* Plot pad as a segment. */
{
@ -428,6 +392,7 @@ void GERBER_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
if( trace_mode == FILLED )
{
/* XXX to do: use an aperture macro to declare the rotated pad */
/* The pad is reduced to an oval with dy > dx */
delta = size.y - size.x;
x0 = 0;
@ -436,104 +401,100 @@ void GERBER_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
y1 = delta / 2;
RotatePoint( &x0, &y0, orient );
RotatePoint( &x1, &y1, orient );
thick_segment( wxPoint( pos.x + x0, pos.y + y0 ),
ThickSegment( wxPoint( pos.x + x0, pos.y + y0 ),
wxPoint( pos.x + x1, pos.y + y1 ),
size.x, trace_mode );
}
else
{
sketch_oval( pos, size, orient, -1 );
sketchOval( pos, size, orient, -1 );
}
}
}
/* Plot rectangular pad.
* Gives its center, size, and orientation
* For a vertical or horizontal shape, the shape is an aperture (Dcode) and
* it is flashed.
* For others shape the direction is plotted as a polygon.
/**
* Filled rect flashes are handled as aperture in the 90 degree positions only
*/
void GERBER_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size,
int orient, EDA_DRAW_MODE_T trace_mode )
void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
int orient, EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
wxASSERT( outputFile );
wxSize size( aSize );
/* Plot as flashed. */
switch( orient )
{
case 900:
case 2700: /* rotation of 90 degrees or 270 returns dimensions */
EXCHG( size.x, size.y );
case 2700: /* rotation of 90 degrees or 270 swaps dimensions */
EXCHG( size.x, size.y );
// Pass through
// Pass through
case 0:
case 1800:
switch( trace_mode )
{
case LINE:
case SKETCH:
set_current_line_width( -1 );
rect( wxPoint( pos.x - (size.x - current_pen_width) / 2,
pos.y - (size.y - current_pen_width) / 2 ),
wxPoint( pos.x + (size.x - current_pen_width) / 2,
pos.y + (size.y - current_pen_width) / 2 ),
NO_FILL );
break;
switch( trace_mode )
{
case LINE:
case SKETCH:
SetCurrentLineWidth( -1 );
Rect( wxPoint( pos.x - (size.x - currentPenWidth) / 2,
pos.y - (size.y - currentPenWidth) / 2 ),
wxPoint( pos.x + (size.x - currentPenWidth) / 2,
pos.y + (size.y - currentPenWidth) / 2 ),
NO_FILL );
break;
case FILLED:
user_to_device_coordinates( pos );
select_aperture( size, APERTURE::Rect );
fprintf( output_file, "X%5.5dY%5.5dD03*\n", pos.x, pos.y );
break;
}
case FILLED:
DPOINT pos_dev = userToDeviceCoordinates( pos );
selectAperture( size, APERTURE::Rect );
emitDcode( pos_dev, 3 );
break;
}
break;
break;
default: // plot pad shape as polygon
{
// XXX to do: use an aperture macro to declare the rotated pad
wxPoint coord[4];
// coord[0] is assumed the lower left
// coord[1] is assumed the upper left
// coord[2] is assumed the upper right
// coord[3] is assumed the lower right
default: /* plot pad shape as polygon */
{
wxPoint coord[4];
// coord[0] is assumed the lower left
// coord[1] is assumed the upper left
// coord[2] is assumed the upper right
// coord[3] is assumed the lower right
/* Trace the outline. */
coord[0].x = -size.x/2; // lower left
coord[0].y = size.y/2;
coord[1].x = -size.x/2; // upper left
coord[1].y = -size.y/2;
coord[2].x = size.x/2; // upper right
coord[2].y = -size.y/2;
coord[3].x = size.x/2; // lower right
coord[3].y = size.y/2;
/* Trace the outline. */
coord[0].x = -size.x/2; // lower left
coord[0].y = size.y/2;
coord[1].x = -size.x/2; // upper left
coord[1].y = -size.y/2;
coord[2].x = size.x/2; // upper right
coord[2].y = -size.y/2;
coord[3].x = size.x/2; //lower right
coord[3].y = size.y/2;
flash_pad_trapez( pos, coord, orient, trace_mode );
}
break;
FlashPadTrapez( pos, coord, orient, trace_mode );
}
break;
}
}
/* Plot trapezoidal pad.
* aPadPos is pad position, aCorners the corners positions of the basic shape
* Orientation aPadOrient in 0.1 degrees
* Plot mode = FILLED or SKETCH
/**
* Trapezoidal pad at the moment are *never* handled as aperture, since
* they require aperture macros
*/
void GERBER_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCorners,
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
{
// XXX to do: use an aperture macro to declare the pad
// polygon corners list
static std::vector< wxPoint > cornerList;
cornerList.clear();
std::vector< wxPoint > cornerList;
for( int ii = 0; ii < 4; ii++ )
cornerList.push_back( aCorners[ii] );
/* Draw the polygon and fill the interior as required. */
// Draw the polygon and fill the interior as required
for( unsigned ii = 0; ii < 4; ii++ )
{
RotatePoint( &cornerList[ii], aPadOrient );
@ -543,15 +504,19 @@ void GERBER_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size,
// Close the polygon
cornerList.push_back( cornerList[0] );
set_current_line_width( -1 );
SetCurrentLineWidth( -1 );
PlotPoly( cornerList, aTrace_Mode==FILLED ? FILLED_SHAPE : NO_FILL );
}
/**
* Change the plot polarity and begin a new layer
* Used to 'scratch off' silk screen away from solder mask
*/
void GERBER_PLOTTER::SetLayerPolarity( bool aPositive )
{
if( aPositive )
fprintf( output_file, "%%LPD*%%\n" );
fprintf( outputFile, "%%LPD*%%\n" );
else
fprintf( output_file, "%%LPC*%%\n" );
fprintf( outputFile, "%%LPC*%%\n" );
}

View File

@ -1,6 +1,10 @@
/**
* @file common_plotHPGL_functions.cpp
* @brief KiCad: Common plot HPGL Routines
* Filled primitive are not supported, but some could be using HPGL/2
* Since this plot engine is mostly intended for import in external programs,
* sadly HPGL/2 isn't supported a lot... some of the primitives use overlapped
* strokes to fill the shape
*/
#include <fctsys.h>
@ -12,184 +16,163 @@
#include <macros.h>
#include <kicad_string.h>
// HPGL scale factor.
const double SCALE_HPGL = 0.102041;
// HPGL scale factor (1 PLU = 1/40mm IIRC)
static const double PLUsPERDECIMIL = 0.102041;
void HPGL_PLOTTER::set_viewport( wxPoint aOffset, double aScale, bool aMirror )
void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
wxASSERT( !output_file );
plot_offset = aOffset;
plot_scale = aScale;
device_scale = SCALE_HPGL;
set_default_line_width( 100 ); // default line width in 1 / 1000 inch
wxASSERT( !outputFile );
plotOffset = aOffset;
plotScale = aScale;
iuPerDeviceUnit = PLUsPERDECIMIL / aIusPerDecimil;
/* Compute the paper size in IUs */
paperSize = pageInfo.GetSizeMils();
paperSize.x *= 10.0 * aIusPerDecimil;
paperSize.y *= 10.0 * aIusPerDecimil;
SetDefaultLineWidth( 0 ); // HPGL has pen sizes instead
plotMirror = aMirror;
}
bool HPGL_PLOTTER::start_plot( FILE* fout )
/**
* At the start of the HPGL plot pen speed and number are requested
*/
bool HPGL_PLOTTER::StartPlot( FILE* fout )
{
wxASSERT( !output_file );
output_file = fout;
fprintf( output_file, "IN;VS%d;PU;PA;SP%d;\n", pen_speed, pen_number );
wxASSERT( !outputFile );
outputFile = fout;
fprintf( outputFile, "IN;VS%d;PU;PA;SP%d;\n", penSpeed, penNumber );
return true;
}
bool HPGL_PLOTTER::end_plot()
/**
* HPGL end of plot: pen return and release
*/
bool HPGL_PLOTTER::EndPlot()
{
wxASSERT( output_file );
fputs( "PU;PA;SP0;\n", output_file );
fclose( output_file );
output_file = NULL;
wxASSERT( outputFile );
fputs( "PU;PA;SP0;\n", outputFile );
fclose( outputFile );
outputFile = NULL;
return true;
}
void HPGL_PLOTTER::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width )
/**
* HPGL rectangle: fill not supported
*/
void HPGL_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width )
{
wxASSERT( output_file );
user_to_device_coordinates( p2 );
move_to( p1 );
fprintf( output_file, "EA %d,%d;\n", p2.x, p2.y );
pen_finish();
wxASSERT( outputFile );
DPOINT p2dev = userToDeviceCoordinates( p2 );
MoveTo( p1 );
fprintf( outputFile, "EA %.0f,%.0f;\n", p2dev.x, p2dev.y );
PenFinish();
}
void HPGL_PLOTTER::circle( wxPoint centre,
int diameter,
FILL_T fill,
int width )
/**
* HPGL circle: fill not supported
*/
void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill,
int width )
{
wxASSERT( output_file );
double rayon = user_to_device_size( diameter / 2 );
wxASSERT( outputFile );
double radius = userToDeviceSize( diameter / 2 );
if( rayon > 0 )
if( radius > 0 )
{
move_to( centre );
fprintf( output_file, "CI %g;\n", rayon );
pen_finish();
MoveTo( centre );
fprintf( outputFile, "CI %g;\n", radius );
PenFinish();
}
}
/* Plot a polygon (closed if completed) in HPGL
* aCornerList = a wxPoint list of corner
* aFill: if != 0 filled polygon
/**
* HPGL polygon: fill not supported (but closed, at least)
*/
void HPGL_PLOTTER::PlotPoly( std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth)
void HPGL_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth)
{
if( aCornerList.size() <= 1 )
return;
move_to( aCornerList[0] );
MoveTo( aCornerList[0] );
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
line_to( aCornerList[ii] );
LineTo( aCornerList[ii] );
// Close polygon if filled.
if( aFill )
{
int ii = aCornerList.size() - 1;
if( aCornerList[ii] != aCornerList[0] )
line_to( aCornerList[0] );
LineTo( aCornerList[0] );
}
pen_finish();
}
/*
* Function PlotImage
* Only Postscript plotters can plot bitmaps
* for plotters that cannot plot a bitmap, a rectangle is plotted
* For HPGL_PLOTTER, draws a rectangle
* param aImage = the bitmap
* param aPos = position of the center of the bitmap
* param aScaleFactor = the scale factor to apply to the bitmap size
* (this is not the plot scale factor)
*/
void HPGL_PLOTTER::PlotImage( wxImage & aImage, wxPoint aPos, double aScaleFactor )
{
wxSize size;
size.x = aImage.GetWidth();
size.y = aImage.GetHeight();
size.x = KiROUND( size.x * aScaleFactor );
size.y = KiROUND( size.y * aScaleFactor );
wxPoint start = aPos;
start.x -= size.x / 2;
start.y -= size.y / 2;
wxPoint end = start;
end.x += size.x;
end.y += size.y;
rect( start, end, NO_FILL );
PenFinish();
}
/* Set pen up ('U') or down ('D').
/**
* Pen control logic (remove redundant pen activations)
*/
void HPGL_PLOTTER::pen_control( int plume )
void HPGL_PLOTTER::penControl( char plume )
{
wxASSERT( output_file );
wxASSERT( outputFile );
switch( plume )
{
case 'U':
if( pen_state != 'U' )
if( penState != 'U' )
{
fputs( "PU;", output_file );
pen_state = 'U';
fputs( "PU;", outputFile );
penState = 'U';
}
break;
case 'D':
if( pen_state != 'D' )
if( penState != 'D' )
{
fputs( "PD;", output_file );
pen_state = 'D';
fputs( "PD;", outputFile );
penState = 'D';
}
break;
case 'Z':
fputs( "PU;", output_file );
pen_state = 'U';
pen_lastpos.x = -1;
pen_lastpos.y = -1;
fputs( "PU;", outputFile );
penState = 'U';
penLastpos.x = -1;
penLastpos.y = -1;
break;
}
}
/*
* Move the pen to position with pen up or down.
* At position x, y
* Unit to unit DRAWING
* If pen = 'Z' without changing pen during move.
*/
void HPGL_PLOTTER::pen_to( wxPoint pos, char plume )
void HPGL_PLOTTER::PenTo( const wxPoint& pos, char plume )
{
wxASSERT( output_file );
wxASSERT( outputFile );
if( plume == 'Z' )
{
pen_control( 'Z' );
penControl( 'Z' );
return;
}
pen_control( plume );
user_to_device_coordinates( pos );
penControl( plume );
DPOINT pos_dev = userToDeviceCoordinates( pos );
if( pen_lastpos != pos )
fprintf( output_file, "PA %d,%d;\n", pos.x, pos.y );
if( penLastpos != pos )
fprintf( outputFile, "PA %.0f,%.0fd;\n", pos_dev.x, pos_dev.y );
pen_lastpos = pos;
penLastpos = pos;
}
void HPGL_PLOTTER::set_dash( bool dashed )
/**
* HPGL supports dashed lines
*/
void HPGL_PLOTTER::SetDash( bool dashed )
{
wxASSERT( output_file );
wxASSERT( outputFile );
if( dashed )
fputs( "LI 2;\n", stderr );
else
@ -197,27 +180,21 @@ void HPGL_PLOTTER::set_dash( bool dashed )
}
/**
* Function Plot a filled segment (track)
* @param start = starting point
* @param end = ending point
* @param width = segment width (thickness)
* @param tracemode = FILLED, SKETCH ..
*/
void HPGL_PLOTTER::thick_segment( wxPoint start, wxPoint end, int width, EDA_DRAW_MODE_T tracemode )
void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end,
int width, EDA_DRAW_MODE_T tracemode )
{
wxASSERT( output_file );
wxASSERT( outputFile );
wxPoint center;
wxSize size;
if( (pen_diameter >= width) || (tracemode == LINE) ) /* just a line is
* Ok */
// Suppress overlap if pen is too big or in line mode
if( (penDiameter >= width) || (tracemode == LINE) )
{
move_to( start );
finish_to( end );
MoveTo( start );
FinishTo( end );
}
else
segment_as_oval( start, end, width, tracemode );
segmentAsOval( start, end, width, tracemode );
}
@ -229,48 +206,48 @@ void HPGL_PLOTTER::thick_segment( wxPoint start, wxPoint end, int width, EDA_DRA
* PU PY x, y; PD start_arc_X AA, start_arc_Y, angle, NbSegm; PU;
* Or PU PY x, y; PD start_arc_X AA, start_arc_Y, angle, PU;
*/
void HPGL_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
void HPGL_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius,
FILL_T fill, int width )
{
wxASSERT( output_file );
wxPoint cmap;
wxPoint cpos;
float angle;
wxASSERT( outputFile );
double angle;
if( rayon <= 0 )
if( radius <= 0 )
return;
cpos = centre;
user_to_device_coordinates( cpos );
DPOINT centre_dev = userToDeviceCoordinates( centre );
if( plotMirror )
angle = (StAngle - EndAngle) / 10.0;
else
angle = (EndAngle - StAngle) / 10.0;
// Calculate start point,
cmap.x = (int) ( centre.x + ( rayon * cos( StAngle * M_PI / 1800 ) ) );
cmap.y = (int) ( centre.y - ( rayon * sin( StAngle * M_PI / 1800 ) ) );
user_to_device_coordinates( cmap );
fprintf( output_file,
"PU;PA %d,%d;PD;AA %d,%d, ",
cmap.x,
cmap.y,
cpos.x,
cpos.y );
fprintf( output_file, "%f", angle );
fprintf( output_file, ";PU;\n" );
pen_finish();
// Calculate start point,
wxPoint cmap;
cmap.x = (int) ( centre.x + ( radius * cos( RAD2DEG( StAngle / 10.0 ) ) ) );
cmap.y = (int) ( centre.y - ( radius * sin( RAD2DEG( StAngle / 10.0 ) ) ) );
DPOINT cmap_dev = userToDeviceCoordinates( cmap );
fprintf( outputFile,
"PU;PA %.0f,%.0f;PD;AA %.0f,%.0f,",
cmap_dev.x,
cmap_dev.y,
centre_dev.x,
centre_dev.y );
fprintf( outputFile, "%.0f", angle );
fprintf( outputFile, ";PU;\n" );
PenFinish();
}
/* Plot oval pad.
*/
void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
EDA_DRAW_MODE_T trace_mode )
void HPGL_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int orient,
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
wxASSERT( outputFile );
int deltaxy, cx, cy;
wxSize size( aSize );
/* The pad is reduced to an oval with size.y > size.x
* (Oval vertical orientation 0)
@ -285,82 +262,68 @@ void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
if( trace_mode == FILLED )
{
flash_pad_rect( pos, wxSize( size.x, deltaxy + KiROUND( pen_diameter ) ),
orient, trace_mode );
FlashPadRect( pos, wxSize( size.x, deltaxy + KiROUND( penDiameter ) ),
orient, trace_mode );
cx = 0; cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
flash_pad_circle( wxPoint( cx + pos.x,
cy + pos.y ), size.x, trace_mode );
FlashPadCircle( wxPoint( cx + pos.x, cy + pos.y ), size.x, trace_mode );
cx = 0; cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient );
flash_pad_circle( wxPoint( cx + pos.x,
cy + pos.y ), size.x, trace_mode );
FlashPadCircle( wxPoint( cx + pos.x, cy + pos.y ), size.x, trace_mode );
}
else // Plot in SKETCH mode.
{
sketch_oval( pos, size, orient, KiROUND( pen_diameter ) );
sketchOval( pos, size, orient, KiROUND( penDiameter ) );
}
}
/* Plot round pad or via.
*/
void HPGL_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
EDA_DRAW_MODE_T trace_mode )
void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
int rayon, delta;
wxASSERT( outputFile );
DPOINT pos_dev = userToDeviceCoordinates( pos );
user_to_device_coordinates( pos );
delta = KiROUND( pen_diameter - pen_overlap );
rayon = diametre / 2;
int delta = KiROUND( penDiameter - penOverlap );
int radius = diametre / 2;
if( trace_mode != LINE )
{
rayon = ( diametre - KiROUND( pen_diameter ) ) / 2;
radius = ( diametre - KiROUND( penDiameter ) ) / 2;
}
if( rayon < 0 )
if( radius < 0 )
{
rayon = 0;
radius = 0;
}
wxSize rsize( rayon, rayon );
user_to_device_size( rsize );
double rsize = userToDeviceSize( radius );
fprintf( output_file, "PA %d,%d;CI %d;\n", pos.x, pos.y, rsize.x );
fprintf( outputFile, "PA %.0f,%.0fd;CI %.0f;\n",
pos_dev.x, pos_dev.y, rsize );
if( trace_mode == FILLED ) // Plot in filled mode.
{
if( delta > 0 )
{
while( (rayon -= delta ) >= 0 )
while( (radius -= delta ) >= 0 )
{
rsize.x = rsize.y = rayon;
user_to_device_size( rsize );
fprintf( output_file,
"PA %d,%d; CI %d;\n",
pos.x,
pos.y,
rsize.x );
rsize = userToDeviceSize( radius );
fprintf( outputFile, "PA %.0f,%.0f;CI %.0f;\n",
pos_dev.x, pos_dev.y, rsize );
}
}
}
pen_finish();
return;
PenFinish();
}
/*
* Plot rectangular pad vertical or horizontal.
* Gives its center and its dimensions X and Y
* Units are user units
*/
void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
int orient, EDA_DRAW_MODE_T trace_mode )
void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
int orient, EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
wxASSERT( outputFile );
wxSize size;
int delta;
int ox, oy, fx, fy;
@ -370,8 +333,8 @@ void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
if( trace_mode != LINE )
{
size.x = (padsize.x - (int) pen_diameter) / 2;
size.y = (padsize.y - (int) pen_diameter) / 2;
size.x = (padsize.x - (int) penDiameter) / 2;
size.y = (padsize.y - (int) penDiameter) / 2;
}
if( size.x < 0 )
@ -388,8 +351,8 @@ void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
fx = pos.x;
fy = pos.y + size.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
move_to( wxPoint( ox, oy ) );
finish_to( wxPoint( fx, fy ) );
MoveTo( wxPoint( ox, oy ) );
FinishTo( wxPoint( fx, fy ) );
return;
}
if( size.y == 0 )
@ -400,37 +363,37 @@ void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
fx = pos.x + size.x;
fy = pos.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
move_to( wxPoint( ox, oy ) );
finish_to( wxPoint( fx, fy ) );
MoveTo( wxPoint( ox, oy ) );
FinishTo( wxPoint( fx, fy ) );
return;
}
ox = pos.x - size.x;
oy = pos.y - size.y;
RotatePoint( &ox, &oy, pos.x, pos.y, orient );
move_to( wxPoint( ox, oy ) );
MoveTo( wxPoint( ox, oy ) );
fx = pos.x - size.x;
fy = pos.y + size.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
line_to( wxPoint( fx, fy ) );
LineTo( wxPoint( fx, fy ) );
fx = pos.x + size.x;
fy = pos.y + size.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
line_to( wxPoint( fx, fy ) );
LineTo( wxPoint( fx, fy ) );
fx = pos.x + size.x;
fy = pos.y - size.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
line_to( wxPoint( fx, fy ) );
LineTo( wxPoint( fx, fy ) );
finish_to( wxPoint( ox, oy ) );
FinishTo( wxPoint( ox, oy ) );
if( trace_mode == FILLED )
{
// Plot in filled mode.
delta = (int) (pen_diameter - pen_overlap);
delta = (int) (penDiameter - penOverlap);
if( delta > 0 )
while( (size.x > 0) && (size.y > 0) )
@ -446,44 +409,39 @@ void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
ox = pos.x - size.x;
oy = pos.y - size.y;
RotatePoint( &ox, &oy, pos.x, pos.y, orient );
move_to( wxPoint( ox, oy ) );
MoveTo( wxPoint( ox, oy ) );
fx = pos.x - size.x;
fy = pos.y + size.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
line_to( wxPoint( fx, fy ) );
LineTo( wxPoint( fx, fy ) );
fx = pos.x + size.x;
fy = pos.y + size.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
line_to( wxPoint( fx, fy ) );
LineTo( wxPoint( fx, fy ) );
fx = pos.x + size.x;
fy = pos.y - size.y;
RotatePoint( &fx, &fy, pos.x, pos.y, orient );
line_to( wxPoint( fx, fy ) );
LineTo( wxPoint( fx, fy ) );
finish_to( wxPoint( ox, oy ) );
FinishTo( wxPoint( ox, oy ) );
}
}
}
/* Plot trapezoidal pad.
* aPadPos is pad position, aCorners the corners position of the basic shape
* Orientation aPadOrient in 0.1 degrees
* Plot mode FILLED or SKETCH
*/
void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
void HPGL_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
{
wxASSERT( output_file );
wxASSERT( outputFile );
wxPoint polygone[4]; // coordinates of corners relatives to the pad
wxPoint coord[4]; // absolute coordinates of corners (coordinates in plotter space)
int move;
move = KiROUND( pen_diameter );
move = KiROUND( penDiameter );
for( int ii = 0; ii < 4; ii++ )
polygone[ii] = aCorners[ii];
@ -500,11 +458,11 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
RotatePoint( &coord[ii], aPadOrient );
coord[ii] += aPadPos;
}
move_to( coord[0] );
line_to( coord[1] );
line_to( coord[2] );
line_to( coord[3] );
finish_to( coord[0] );
MoveTo( coord[0] );
LineTo( coord[1] );
LineTo( coord[2] );
LineTo( coord[3] );
FinishTo( coord[0] );
// Fill shape:
if( aTrace_Mode == FILLED )
@ -512,20 +470,20 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
// TODO: replace this par the HPGL plot polygon.
int jj;
// Fill the shape
move = KiROUND( pen_diameter - pen_overlap );
move = KiROUND( penDiameter - penOverlap );
// Calculate fill height.
if( polygone[0].y == polygone[3].y ) // Horizontal
{
jj = polygone[3].y - (int) ( pen_diameter + ( 2 * pen_overlap ) );
jj = polygone[3].y - (int) ( penDiameter + ( 2 * penOverlap ) );
}
else // vertical
{
jj = polygone[3].x - (int) ( pen_diameter + ( 2 * pen_overlap ) );
jj = polygone[3].x - (int) ( penDiameter + ( 2 * penOverlap ) );
}
// Calculation of dd = number of segments was traced to fill.
jj = jj / (int) ( pen_diameter - pen_overlap );
jj = jj / (int) ( penDiameter - penOverlap );
// Trace the outline.
for( ; jj > 0; jj-- )
@ -568,11 +526,12 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
coord[ii] += aPadPos;
}
move_to( coord[0] );
line_to( coord[1] );
line_to( coord[2] );
line_to( coord[3] );
finish_to( coord[0] );
MoveTo( coord[0] );
LineTo( coord[1] );
LineTo( coord[2] );
LineTo( coord[3] );
FinishTo( coord[0] );
}
}
}

View File

@ -0,0 +1,771 @@
/**
* @file common_plotPDF_functions.cpp
* @brief Kicad: Common plot PDF Routines
*/
#include <fctsys.h>
#include <appl_wxstruct.h>
#include <trigo.h>
#include <wxstruct.h>
#include <base_struct.h>
#include <common.h>
#include <plot_common.h>
#include <macros.h>
#include <kicad_string.h>
#include <wx/zstream.h>
#include <wx/mstream.h>
void PDF_PLOTTER::SetPageSettings( const PAGE_INFO& aPageSettings )
{
wxASSERT( !workFile );
pageInfo = aPageSettings;
}
void PDF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
wxASSERT( !workFile );
plotMirror = aMirror;
plotOffset = aOffset;
plotScale = aScale;
// The CTM is set to 1 user unit per decimil
iuPerDeviceUnit = 1.0 / aIusPerDecimil;
/* The paper size in this engined is handled page by page
Look in the StartPage function */
}
/**
* Pen width setting for PDF. Since the specs *explicitly* says that a 0
* width is a bad thing to use (since it results in 1 pixel traces), we
* convert such requests to the default width (like -1)
*/
void PDF_PLOTTER::SetCurrentLineWidth( int width )
{
wxASSERT( workFile );
int pen_width;
if( width > 0 )
pen_width = width;
else
pen_width = defaultPenWidth;
if( pen_width != currentPenWidth )
fprintf( workFile, "%g w\n",
userToDeviceSize( pen_width ) );
currentPenWidth = pen_width;
}
/**
* PDF supports colors fully. It actually has distinct fill and pen colors,
* but we set both at the same time.
*
* XXX Keeping them divided could result in a minor optimization in
* eeschema filled shapes, but would propagate to all the other plot
* engines. Also arcs are filled as pies but only the arc is stroked so
* it would be difficult to handle anyway.
*/
void PDF_PLOTTER::emitSetRGBColor( double r, double g, double b )
{
wxASSERT( workFile );
fprintf( workFile, "%g %g %g rg %g %g %g RG\n",
r, g, b, r, g, b );
}
/**
* PDF supports dashed lines
*/
void PDF_PLOTTER::SetDash( bool dashed )
{
wxASSERT( workFile );
if( dashed )
fputs( "[200] 100 d\n", workFile );
else
fputs( "[] 0 d\n", workFile );
}
/**
* Rectangles in PDF. Supported by the native operator
*/
void PDF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width )
{
wxASSERT( workFile );
DPOINT p1_dev = userToDeviceCoordinates( p1 );
DPOINT p2_dev = userToDeviceCoordinates( p2 );
SetCurrentLineWidth( width );
fprintf( workFile, "%g %g %g %g re %c\n", p1_dev.x, p1_dev.y,
p2_dev.x - p1_dev.x, p2_dev.y - p1_dev.y,
fill == NO_FILL ? 'S' : 'B' );
}
/**
* Circle drawing for PDF. They're approximated by curves, but fill is supported
*/
void PDF_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T aFill, int width )
{
wxASSERT( workFile );
DPOINT pos_dev = userToDeviceCoordinates( pos );
double radius = userToDeviceSize( diametre / 2.0 );
/* OK. Here's a trick. PDF doesn't support circles or circular angles, that's
a fact. You'll have to do with cubic beziers. These *can't* represent
circular arcs (NURBS can, beziers don't). But there is a widely known
approximation which is really good */
SetCurrentLineWidth( width );
double magic = radius * 0.551784; // You don't want to know where this come from
// This is the convex hull for the bezier approximated circle
fprintf( workFile, "%g %g m "
"%g %g %g %g %g %g c "
"%g %g %g %g %g %g c "
"%g %g %g %g %g %g c "
"%g %g %g %g %g %g c %c\n",
pos_dev.x - radius, pos_dev.y,
pos_dev.x - radius, pos_dev.y + magic,
pos_dev.x - magic, pos_dev.y + radius,
pos_dev.x, pos_dev.y + radius,
pos_dev.x + magic, pos_dev.y + radius,
pos_dev.x + radius, pos_dev.y + magic,
pos_dev.x + radius, pos_dev.y,
pos_dev.x + radius, pos_dev.y - magic,
pos_dev.x + magic, pos_dev.y - radius,
pos_dev.x, pos_dev.y - radius,
pos_dev.x - magic, pos_dev.y - radius,
pos_dev.x - radius, pos_dev.y - magic,
pos_dev.x - radius, pos_dev.y,
aFill == NO_FILL ? 's' : 'b' );
}
/**
* The PDF engine can't directly plot arcs, it uses the base emulation.
* So no filled arcs (not a great loss... )
*/
void PDF_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius,
FILL_T fill, int width )
{
wxASSERT( workFile );
if( radius <= 0 )
return;
/* Arcs are not so easily approximated by beziers (in the general case),
so we approximate them in the old way */
wxPoint start, end;
const int delta = 50; // increment (in 0.1 degrees) to draw circles
if( StAngle > EndAngle )
EXCHG( StAngle, EndAngle );
SetCurrentLineWidth( width );
// Usual trig arc plotting routine...
double alpha = DEG2RAD( StAngle / 10.0 );
start.x = centre.x + (int) ( radius * cos( -alpha ) );
start.y = centre.y + (int) ( radius * sin( -alpha ) );
DPOINT pos_dev = userToDeviceCoordinates( start );
fprintf( workFile, "%g %g m ", pos_dev.x, pos_dev.y );
for( int ii = StAngle + delta; ii < EndAngle; ii += delta )
{
alpha = DEG2RAD( ii / 10.0 );
end.x = centre.x + (int) ( radius * cos( -alpha ) );
end.y = centre.y + (int) ( radius * sin( -alpha ) );
pos_dev = userToDeviceCoordinates( end );
fprintf( workFile, "%g %g l ", pos_dev.x, pos_dev.y );
}
alpha = DEG2RAD( EndAngle / 10.0 );
end.x = centre.x + (int) ( radius * cos( -alpha ) );
end.y = centre.y + (int) ( radius * sin( -alpha ) );
pos_dev = userToDeviceCoordinates( end );
fprintf( workFile, "%g %g l ", pos_dev.x, pos_dev.y );
// The arc is drawn... if not filled we stroke it, otherwise we finish
// closing the pie at the center
if( fill == NO_FILL )
{
fputs( "S\n", workFile );
}
else
{
pos_dev = userToDeviceCoordinates( centre );
fprintf( workFile, "%g %g l b\n", pos_dev.x, pos_dev.y );
}
}
/**
* Polygon plotting for PDF. Everything is supported
*/
void PDF_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth )
{
wxASSERT( workFile );
if( aCornerList.size() <= 1 )
return;
SetCurrentLineWidth( aWidth );
DPOINT pos = userToDeviceCoordinates( aCornerList[0] );
fprintf( workFile, "%g %g m\n", pos.x, pos.y );
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
{
pos = userToDeviceCoordinates( aCornerList[ii] );
fprintf( workFile, "%g %g l\n", pos.x, pos.y );
}
// Close path and stroke(/fill)
fprintf( workFile, "%c\n", aFill == NO_FILL ? 'S' : 'b' );
}
void PDF_PLOTTER::PenTo( const wxPoint& pos, char plume )
{
wxASSERT( workFile );
if( plume == 'Z' )
{
if( penState != 'Z' )
{
fputs( "S\n", workFile );
penState = 'Z';
penLastpos.x = -1;
penLastpos.y = -1;
}
return;
}
if( penState != plume || pos != penLastpos )
{
DPOINT pos_dev = userToDeviceCoordinates( pos );
fprintf( workFile, "%g %g %c\n",
pos_dev.x, pos_dev.y,
( plume=='D' ) ? 'l' : 'm' );
}
penState = plume;
penLastpos = pos;
}
/**
* PDF images are handles as inline, not XObject streams...
*/
void PDF_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
double aScaleFactor )
{
wxASSERT( workFile );
wxSize pix_size( aImage.GetWidth(), aImage.GetHeight() );
// Requested size (in IUs)
DPOINT drawsize( aScaleFactor * pix_size.x,
aScaleFactor * pix_size.y );
// calculate the bitmap start position
wxPoint start( aPos.x - drawsize.x / 2,
aPos.y + drawsize.y / 2);
DPOINT dev_start = userToDeviceCoordinates( start );
/* PDF has an uhm... simplified coordinate system handling. There is
*one* operator to do everything (the PS concat equivalent). At least
they kept the matrix stack to save restore environments. Also images
are always emitted at the origin with a size of 1x1 user units.
What we need to do is:
1) save the CTM end estabilish the new one
2) plot the image
3) restore the CTM
4) profit
*/
fprintf( workFile, "q %g 0 0 %g %g %g cm\n", // Step 1
userToDeviceSize( drawsize.x ),
userToDeviceSize( drawsize.y ),
dev_start.x, dev_start.y );
/* An inline image is a cross between a dictionary and a stream.
A real ugly construct (compared with the elegance of the PDF
format). Also it accepts some 'abbreviations', which is stupid
since the content stream is usually compressed anyway... */
fprintf( workFile,
"BI\n"
" /BPC 8\n"
" /CS %s\n"
" /W %d\n"
" /H %d\n"
"ID\n", colorMode ? "/RGB" : "/G", pix_size.x, pix_size.y );
/* Here comes the stream (in binary!). I *could* have hex or ascii84
encoded it, but who cares? I'll go through zlib anyway */
for( int y = 0; y < pix_size.y; y++ )
{
for( int x = 0; x < pix_size.x; x++ )
{
unsigned char r = aImage.GetRed( x, y ) & 0xFF;
unsigned char g = aImage.GetGreen( x, y ) & 0xFF;
unsigned char b = aImage.GetBlue( x, y ) & 0xFF;
// As usual these days, stdio buffering has to suffeeeeerrrr
if( colorMode )
{
putc( r, workFile );
putc( g, workFile );
putc( b, workFile );
}
else
{
// Grayscale conversion
putc( (r + g + b) / 3, workFile );
}
}
}
fputs( "EI Q\n", workFile ); // Finish step 2 and do step 3
}
/**
* Allocate a new handle in the table of the PDF object. The
* handle must be completed using startPdfObject. It's an in-RAM operation
* only, no output is done.
*/
int PDF_PLOTTER::allocPdfObject()
{
xrefTable.push_back( 0 );
return xrefTable.size() - 1;
}
/**
* Open a new PDF object and returns the handle if the parameter is -1.
* Otherwise fill in the xref entry for the passed object
*/
int PDF_PLOTTER::startPdfObject(int handle)
{
wxASSERT( outputFile );
wxASSERT( !workFile );
if( handle < 0)
handle = allocPdfObject();
xrefTable[handle] = ftell( outputFile );
fprintf( outputFile, "%d 0 obj\n", handle );
return handle;
}
/**
* Close the current PDF object
*/
void PDF_PLOTTER::closePdfObject()
{
wxASSERT( outputFile );
wxASSERT( !workFile );
fputs( "endobj\n", outputFile );
}
/**
* Starts a PDF stream (for the page). Returns the object handle opened
* Pass -1 (default) for a fresh object. Especially from PDF 1.5 streams
* can contain a lot of things, but for the moment we only handle page
* content.
*/
int PDF_PLOTTER::startPdfStream(int handle)
{
wxASSERT( outputFile );
wxASSERT( !workFile );
handle = startPdfObject( handle );
// This is guaranteed to be handle+1 but needs to be allocated since
// you could allocate more object during stream preparation
streamLengthHandle = allocPdfObject();
fprintf( outputFile,
"<< /Length %d 0 R /Filter /FlateDecode >>\n" // Length is deferred
"stream\n", handle + 1 );
// Open a temporary file to accumulate the stream
workFilename = filename + wxT(".tmp");
workFile = wxFopen( workFilename, wxT( "w+b" ));
wxASSERT( workFile );
return handle;
}
/**
* Finish the current PDF stream (writes the deferred length, too)
* XXX the compression code is not very elegant... is slurps the
* whole stream in RAM, allocates an output buffer of the same size
* and try to FLATE it. Asserts if it couldn't... enhancements are
* welcome but for now it simply works
*/
void PDF_PLOTTER::closePdfStream()
{
wxASSERT( workFile );
int stream_len = ftell( workFile );
// Rewind the file, read in the page stream and DEFLATE it
fseek( workFile, 0, SEEK_SET );
unsigned char *inbuf = new unsigned char[stream_len];
int rc = fread( inbuf, 1, stream_len, workFile );
wxASSERT( rc == stream_len );
(void) rc;
// We are done with the temporary file, junk it
fclose( workFile );
workFile = 0;
::wxRemoveFile( workFilename );
// NULL means memos owns the memory, but provide a hint on optimum size needed.
wxMemoryOutputStream memos( NULL, std::max( 2000, stream_len ) ) ;
{
/* Somewhat standard parameters to compress in DEFLATE. The PDF spec is
misleading, it says it wants a DEFLATE stream but it really want a ZLIB
stream! (a DEFLATE stream would be generated with -15 instead of 15)
rc = deflateInit2( &zstrm, Z_BEST_COMPRESSION, Z_DEFLATED, 15,
8, Z_DEFAULT_STRATEGY );
*/
wxZlibOutputStream zos( memos, wxZ_BEST_COMPRESSION, wxZLIB_ZLIB );
zos.Write( inbuf, stream_len );
delete[] inbuf;
} // flush the zip stream using zos destructor
wxStreamBuffer* sb = memos.GetOutputStreamBuffer();
unsigned out_count = sb->Tell();
fwrite( sb->GetBufferStart(), 1, out_count, outputFile );
fputs( "endstream\n", outputFile );
closePdfObject();
// Writing the deferred length as an indirect object
startPdfObject( streamLengthHandle );
fprintf( outputFile, "%u\n", out_count );
closePdfObject();
}
/**
* Starts a new page in the PDF document
*/
void PDF_PLOTTER::StartPage()
{
wxASSERT( outputFile );
wxASSERT( !workFile );
// Compute the paper size in IUs
paperSize = pageInfo.GetSizeMils();
paperSize.x *= 10.0 / iuPerDeviceUnit;
paperSize.y *= 10.0 / iuPerDeviceUnit;
SetDefaultLineWidth( 100 / iuPerDeviceUnit ); // arbitrary default
// Open the content stream; the page object will go later
pageStreamHandle = startPdfStream();
/* Now, until ClosePage *everything* must be wrote in workFile, to be
compressed later in closePdfStream */
// Default graphic settings (coordinate system, default color and line style)
fprintf( workFile,
"%g 0 0 %g 0 0 cm 1 J 1 j 0 0 0 rg 0 0 0 RG %g w\n",
0.0072 * plotScaleAdjX, 0.0072 * plotScaleAdjY,
userToDeviceSize( defaultPenWidth ) );
}
/**
* Close the current page in the PDF document (and emit its compressed stream)
*/
void PDF_PLOTTER::ClosePage()
{
wxASSERT( workFile );
// Close the page stream (and compress it)
closePdfStream();
// Emit the page object and put it in the page list for later
pageHandles.push_back( startPdfObject() );
/* Page size is in 1/72 of inch (default user space units)
Works like the bbox in postscript but there is no need for
swapping the sizes, since PDF doesn't require a portrait page.
We use the MediaBox but PDF has lots of other less used boxes
to use */
const double BIGPTsPERMIL = 0.072;
wxSize psPaperSize = pageInfo.GetSizeMils();
fprintf( outputFile,
"<<\n"
"/Type /Page\n"
"/Parent %d 0 R\n"
"/Resources <<\n"
" /ProcSet [/PDF /Text /ImageC /ImageB]\n"
" /Font %d 0 R >>\n"
"/MediaBox [0 0 %d %d]\n"
"/Contents %d 0 R\n"
">>\n",
pageTreeHandle,
fontResDictHandle,
int( ceil( psPaperSize.x * BIGPTsPERMIL ) ),
int( ceil( psPaperSize.y * BIGPTsPERMIL ) ),
pageStreamHandle );
closePdfObject();
// Mark the page stream as idle
pageStreamHandle = 0;
}
/**
* The PDF engine supports multiple pages; the first one is opened
* 'for free' the following are to be closed and reopened. Between
* each page parameters can be set
*/
bool PDF_PLOTTER::StartPlot( FILE* fout )
{
wxASSERT( !outputFile );
outputFile = fout;
// First things first: the customary null object
xrefTable.clear();
xrefTable.push_back( 0 );
/* The header (that's easy!). The second line is binary junk required
to make the file binary from the beginning (the important thing is
that they must have the bit 7 set) */
fputs( "%PDF-1.5\n%\200\201\202\203\n", outputFile );
/* Allocate an entry for the page tree root, it will go in every page
parent entry */
pageTreeHandle = allocPdfObject();
/* In the same way, the font resource dictionary is used by every page
(it *could* be inherited via the Pages tree */
fontResDictHandle = allocPdfObject();
/* Now, the PDF is read from the end, (more or less)... so we start
with the page stream for page 1. Other more important stuff is written
at the end */
StartPage();
return true;
}
bool PDF_PLOTTER::EndPlot()
{
wxASSERT( outputFile );
// Close the current page (often the only one)
ClosePage();
/* We need to declare the resources we're using (fonts in particular)
The useful standard one is the Helvetica family. Adding external fonts
is *very* involved! */
struct {
const char *psname;
const char *rsname;
int font_handle;
} fontdefs[4] = {
{ "/Helvetica", "/KicadFont", 0 },
{ "/Helvetica-Oblique", "/KicadFontI", 0 },
{ "/Helvetica-Bold", "/KicadFontB", 0 },
{ "/Helvetica-BoldOblique", "/KicadFontBI", 0 }
};
/* Declare the font resources. Since they're builtin fonts, no descriptors (yay!)
We'll need metrics anyway to do any aligment (these are in the shared with
the postscript engine) */
for( int i = 0; i < 4; i++ )
{
fontdefs[i].font_handle = startPdfObject();
fprintf( outputFile,
"<< /BaseFont %s\n"
" /Type /Font\n"
" /Subtype /Type1\n"
/* Adobe is so Mac-based that the nearest thing to Latin1 is
the Windows ANSI encoding! */
" /Encoding /WinAnsiEncoding\n"
">>\n",
fontdefs[i].psname );
closePdfObject();
}
// Named font dictionary (was allocated, now we emit it)
startPdfObject( fontResDictHandle );
fputs( "<<\n", outputFile );
for( int i = 0; i < 4; i++ )
{
fprintf( outputFile, " %s %d 0 R\n",
fontdefs[i].rsname, fontdefs[i].font_handle );
}
fputs( ">>\n", outputFile );
closePdfObject();
/* The page tree: it's a B-tree but luckily we only have few pages!
So we use just an array... The handle was allocated at the beginning,
now we instantiate the corresponding object */
startPdfObject( pageTreeHandle );
fputs( "<<\n"
"/Type /Pages\n"
"/Kids [\n", outputFile );
for( unsigned i = 0; i < pageHandles.size(); i++ )
fprintf( outputFile, "%d 0 R\n", pageHandles[i] );
fprintf( outputFile,
"]\n"
"/Count %ld\n"
">>\n", (long) pageHandles.size() );
closePdfObject();
// The info dictionary
int infoDictHandle = startPdfObject();
char date_buf[250];
time_t ltime = time( NULL );
strftime( date_buf, 250, "D:%Y%m%d%H%M%S",
localtime( &ltime ) );
fprintf( outputFile,
"<<\n"
"/Producer (KiCAD PDF)\n"
"/CreationDate (%s)\n"
"/Creator (%s)\n"
"/Title (%s)\n"
"/Trapped false\n",
date_buf,
TO_UTF8( creator ),
TO_UTF8( filename ) );
fputs( ">>\n", outputFile );
closePdfObject();
// The catalog, at last
int catalogHandle = startPdfObject();
fprintf( outputFile,
"<<\n"
"/Type /Catalog\n"
"/Pages %d 0 R\n"
"/Version /1.5\n"
"/PageMode /UseNone\n"
"/PageLayout /SinglePage\n"
">>\n", pageTreeHandle );
closePdfObject();
/* Emit the xref table (format is crucial to the byte, each entry must
be 20 bytes long, and object zero must be done in that way). Also
the offset must be kept along for the trailer */
long xref_start = ftell( outputFile );
fprintf( outputFile,
"xref\n"
"0 %ld\n"
"0000000000 65535 f \n", (long) xrefTable.size() );
for( unsigned i = 1; i < xrefTable.size(); i++ )
{
fprintf( outputFile, "%010ld 00000 n \n", xrefTable[i] );
}
// Done the xref, go for the trailer
fprintf( outputFile,
"trailer\n"
"<< /Size %lu /Root %d 0 R /Info %d 0 R >>\n"
"startxref\n"
"%ld\n" // The offset we saved before
"%%EOF\n",
(unsigned long) xrefTable.size(), catalogHandle, infoDictHandle, xref_start );
fclose( outputFile );
outputFile = NULL;
return true;
}
void PDF_PLOTTER::Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
int aWidth,
bool aItalic,
bool aBold )
{
// Emit native PDF text (if requested)
if( psTextMode != PSTEXTMODE_STROKE )
{
const char *fontname = aItalic ? (aBold ? "/KicadFontBI" : "/KicadFontI")
: (aBold ? "/KicadFontB" : "/KicadFont");
// Compute the copious tranformation parameters
double ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f;
double wideningFactor, heightFactor;
computeTextParameters( aPos, aText, aOrient, aSize, aH_justify,
aV_justify, aWidth, aItalic, aBold,
&wideningFactor, &ctm_a, &ctm_b, &ctm_c,
&ctm_d, &ctm_e, &ctm_f, &heightFactor );
SetColor( aColor );
SetCurrentLineWidth( aWidth );
/* We use the full CTM instead of the text matrix because the same
coordinate system will be used for the overlining. Also the %f
for the trig part of the matrix to avoid %g going in exponential
format (which is not supported)
Rendermode 0 shows the text, rendermode 3 is invisible */
fprintf( workFile, "q %f %f %f %f %g %g cm BT %s %g Tf %d Tr %g Tz ",
ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f,
fontname, heightFactor,
(psTextMode == PSTEXTMODE_NATIVE) ? 0 : 3,
wideningFactor * 100 );
// The text must be escaped correctly
fputsPostscriptString( workFile, aText );
fputs( " Tj ET\n", workFile );
/* We are still in text coordinates, plot the overbars (if we're
* not doing phantom text) */
if( psTextMode == PSTEXTMODE_NATIVE )
{
std::vector<int> pos_pairs;
postscriptOverlinePositions( aText, aSize.x, aItalic, aBold, &pos_pairs );
int overbar_y = KiROUND( aSize.y * 1.1 );
for( unsigned i = 0; i < pos_pairs.size(); i += 2)
{
/* This is a nontrivial situation: we are *not* in the user
coordinate system, so the userToDeviceCoordinates function
can't be used! Strange as it may seem, the userToDeviceSize
is the right function to use here... */
DPOINT dev_from = userToDeviceSize( wxSize( pos_pairs[i], overbar_y ) );
DPOINT dev_to = userToDeviceSize( wxSize( pos_pairs[i + 1], overbar_y ) );
fprintf( workFile, "%g %g m %g %g l ",
dev_from.x, dev_from.y, dev_to.x, dev_to.y );
}
}
// Stroke and restore the CTM
fputs( "S Q\n", workFile );
}
// Plot the stroked text (if requested)
if( psTextMode != PSTEXTMODE_NATIVE )
{
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
aWidth, aItalic, aBold );
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/**
* @file common_plot_functions.cpp
* @brief Kicad: Common plot Postscript Routines
* @brief Kicad: Common plotting Routines
*/
#include <fctsys.h>
@ -31,7 +31,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
EDA_COLOR_T color;
// Paper is sized in mils. Here is a conversion factor to scale mils to internal units.
int conv_unit = screen->MilsToIuScalar();
int iusPerMil = screen->MilsToIuScalar();
wxString msg;
wxSize text_size;
@ -49,59 +49,59 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
bool thickness = 0; //@todo : use current pen
color = BLACK;
plotter->set_color( color );
plotter->SetColor( color );
// Plot edge.
ref.x = pageInfo.GetLeftMarginMils() * conv_unit;
ref.y = pageInfo.GetTopMarginMils() * conv_unit;
ref.x = pageInfo.GetLeftMarginMils() * iusPerMil;
ref.y = pageInfo.GetTopMarginMils() * iusPerMil;
xg = ( pageSize.x - pageInfo.GetRightMarginMils() ) * conv_unit;
yg = ( pageSize.y - pageInfo.GetBottomMarginMils() ) * conv_unit;
xg = ( pageSize.x - pageInfo.GetRightMarginMils() ) * iusPerMil;
yg = ( pageSize.y - pageInfo.GetBottomMarginMils() ) * iusPerMil;
#if defined(KICAD_GOST)
plotter->move_to( ref );
plotter->MoveTo( ref );
pos.x = xg;
pos.y = ref.y;
plotter->line_to( pos );
plotter->LineTo( pos );
pos.x = xg;
pos.y = yg;
plotter->line_to( pos );
plotter->LineTo( pos );
pos.x = ref.x;
pos.y = yg;
plotter->line_to( pos );
plotter->finish_to( ref );
plotter->LineTo( pos );
plotter->FinishTo( ref );
#else
for( unsigned ii = 0; ii < 2; ii++ )
{
plotter->move_to( ref );
plotter->MoveTo( ref );
pos.x = xg;
pos.y = ref.y;
plotter->line_to( pos );
plotter->LineTo( pos );
pos.x = xg;
pos.y = yg;
plotter->line_to( pos );
plotter->LineTo( pos );
pos.x = ref.x;
pos.y = yg;
plotter->line_to( pos );
plotter->LineTo( pos );
plotter->finish_to( ref );
plotter->FinishTo( ref );
ref.x += GRID_REF_W * conv_unit;
ref.y += GRID_REF_W * conv_unit;
ref.x += GRID_REF_W * iusPerMil;
ref.y += GRID_REF_W * iusPerMil;
xg -= GRID_REF_W * conv_unit;
yg -= GRID_REF_W * conv_unit;
xg -= GRID_REF_W * iusPerMil;
yg -= GRID_REF_W * iusPerMil;
}
#endif
text_size.x = WSTEXTSIZE * conv_unit;
text_size.y = WSTEXTSIZE * conv_unit;
text_size.x = WSTEXTSIZE * iusPerMil;
text_size.y = WSTEXTSIZE * iusPerMil;
// upper left corner in mils
ref.x = pageInfo.GetLeftMarginMils();
@ -116,8 +116,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = ( ref.x - WsItem->m_Posx ) * conv_unit;
pos.y = ( yg - WsItem->m_Posy ) * conv_unit;
pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil;
pos.y = ( yg - WsItem->m_Posy ) * iusPerMil;
msg.Empty();
switch( WsItem->m_Type )
{
@ -127,17 +127,17 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
case WS_PODPIS_LU:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
plotter->text( pos, color,
plotter->Text( pos, color,
msg, TEXT_ORIENT_VERT, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
thickness, italic, false );
break;
case WS_SEGMENT_LU:
plotter->move_to( pos );
pos.x = ( ref.x - WsItem->m_Endx ) * conv_unit;
pos.y = ( yg - WsItem->m_Endy ) * conv_unit;
plotter->finish_to( pos );
plotter->MoveTo( pos );
pos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil;
pos.y = ( yg - WsItem->m_Endy ) * iusPerMil;
plotter->FinishTo( pos );
break;
}
}
@ -146,16 +146,16 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = ( ref.x + WsItem->m_Posx ) * conv_unit;
pos.y = ( ref.y + WsItem->m_Posy ) * conv_unit;
pos.x = ( ref.x + WsItem->m_Posx ) * iusPerMil;
pos.y = ( ref.y + WsItem->m_Posy ) * iusPerMil;
msg.Empty();
switch( WsItem->m_Type )
{
case WS_SEGMENT_LT:
plotter->move_to( pos );
pos.x = ( ref.x + WsItem->m_Endx ) * conv_unit;
pos.y = ( ref.y + WsItem->m_Endy ) * conv_unit;
plotter->finish_to( pos );
plotter->MoveTo( pos );
pos.x = ( ref.x + WsItem->m_Endx ) * iusPerMil;
pos.y = ( ref.y + WsItem->m_Endy ) * iusPerMil;
plotter->FinishTo( pos );
break;
}
}
@ -172,33 +172,33 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
if( ii < xg - PAS_REF / 2 )
{
pos.x = ii * conv_unit;
pos.y = ref.y * conv_unit;
plotter->move_to( pos );
pos.x = ii * conv_unit;
pos.y = ( ref.y + GRID_REF_W ) * conv_unit;
plotter->finish_to( pos );
pos.x = ii * iusPerMil;
pos.y = ref.y * iusPerMil;
plotter->MoveTo( pos );
pos.x = ii * iusPerMil;
pos.y = ( ref.y + GRID_REF_W ) * iusPerMil;
plotter->FinishTo( pos );
}
pos.x = ( ii - gxpas / 2 ) * conv_unit;
pos.y = ( ref.y + GRID_REF_W / 2 ) * conv_unit;
plotter->text( pos, color,
pos.x = ( ii - gxpas / 2 ) * iusPerMil;
pos.y = ( ref.y + GRID_REF_W / 2 ) * iusPerMil;
plotter->Text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
if( ii < xg - PAS_REF / 2 )
{
pos.x = ii * conv_unit;
pos.y = yg * conv_unit;
plotter->move_to( pos );
pos.x = ii * conv_unit;
pos.y = (yg - GRID_REF_W) * conv_unit;
plotter->finish_to( pos );
pos.x = ii * iusPerMil;
pos.y = yg * iusPerMil;
plotter->MoveTo( pos );
pos.x = ii * iusPerMil;
pos.y = (yg - GRID_REF_W) * iusPerMil;
plotter->FinishTo( pos );
}
pos.x = ( ii - gxpas / 2 ) * conv_unit;
pos.y = ( yg - GRID_REF_W / 2 ) * conv_unit;
plotter->text( pos, color,
pos.x = ( ii - gxpas / 2 ) * iusPerMil;
pos.y = ( yg - GRID_REF_W / 2 ) * iusPerMil;
plotter->Text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
@ -215,33 +215,33 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg.Printf( wxT( "%c" ), 'a' + jj - 26 );
if( ii < yg - PAS_REF / 2 )
{
pos.x = ref.x * conv_unit;
pos.y = ii * conv_unit;
plotter->move_to( pos );
pos.x = ( ref.x + GRID_REF_W ) * conv_unit;
pos.y = ii * conv_unit;
plotter->finish_to( pos );
pos.x = ref.x * iusPerMil;
pos.y = ii * iusPerMil;
plotter->MoveTo( pos );
pos.x = ( ref.x + GRID_REF_W ) * iusPerMil;
pos.y = ii * iusPerMil;
plotter->FinishTo( pos );
}
pos.x = ( ref.x + GRID_REF_W / 2 ) * conv_unit;
pos.y = ( ii - gypas / 2 ) * conv_unit;
plotter->text( pos, color,
pos.x = ( ref.x + GRID_REF_W / 2 ) * iusPerMil;
pos.y = ( ii - gypas / 2 ) * iusPerMil;
plotter->Text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
if( ii < yg - PAS_REF / 2 )
{
pos.x = xg * conv_unit;
pos.y = ii * conv_unit;
plotter->move_to( pos );
pos.x = ( xg - GRID_REF_W ) * conv_unit;
pos.y = ii * conv_unit;
plotter->finish_to( pos );
pos.x = xg * iusPerMil;
pos.y = ii * iusPerMil;
plotter->MoveTo( pos );
pos.x = ( xg - GRID_REF_W ) * iusPerMil;
pos.y = ii * iusPerMil;
plotter->FinishTo( pos );
}
pos.x = ( xg - GRID_REF_W / 2 ) * conv_unit;
pos.y = ( ii - gypas / 2 ) * conv_unit;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
pos.x = ( xg - GRID_REF_W / 2 ) * iusPerMil;
pos.y = ( ii - gypas / 2 ) * iusPerMil;
plotter->Text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
}
@ -249,16 +249,16 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
#endif
// Plot the worksheet.
text_size.x = SIZETEXT * conv_unit;
text_size.y = SIZETEXT * conv_unit;
text_size.x = SIZETEXT * iusPerMil;
text_size.y = SIZETEXT * iusPerMil;
#if defined(KICAD_GOST)
text_size2.x = SIZETEXT * conv_unit * 2;
text_size2.y = SIZETEXT * conv_unit * 2;
text_size3.x = SIZETEXT * conv_unit * 3;
text_size3.y = SIZETEXT * conv_unit * 3;
text_size1_5.x = SIZETEXT * conv_unit * 1.5;
text_size1_5.y = SIZETEXT * conv_unit * 1.5;
text_size2.x = SIZETEXT * iusPerMil * 2;
text_size2.y = SIZETEXT * iusPerMil * 2;
text_size3.x = SIZETEXT * iusPerMil * 3;
text_size3.y = SIZETEXT * iusPerMil * 3;
text_size1_5.x = SIZETEXT * iusPerMil * 1.5;
text_size1_5.y = SIZETEXT * iusPerMil * 1.5;
ref.x = pageSize.x - pageInfo.GetRightMarginMils();
ref.y = pageSize.y - pageInfo.GetBottomMarginMils();
@ -269,8 +269,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = ( ref.x - WsItem->m_Posx ) * conv_unit;
pos.y = ( ref.y - WsItem->m_Posy ) * conv_unit;
pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil;
pos.y = ( ref.y - WsItem->m_Posy ) * iusPerMil;
msg.Empty();
switch( WsItem->m_Type )
@ -287,7 +287,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
case WS_PODPIS:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
plotter->text( pos, color,
plotter->Text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
@ -299,9 +299,9 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
case WS_IDENTSHEET:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
if( screen->m_NumberOfScreen > 1 )
if( screen->m_NumberOfScreens > 1 )
msg << screen->m_ScreenNumber;
plotter->text( pos, color,
plotter->Text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
@ -310,8 +310,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
case WS_SHEETS:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << screen->m_NumberOfScreen;
plotter->text( pos, color,
msg << screen->m_NumberOfScreens;
plotter->Text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
@ -321,7 +321,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg = GetTitleBlock().GetCompany();
if( !msg.IsEmpty() )
{
plotter->text( pos, color,
plotter->Text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size1_5,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
@ -332,7 +332,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg = GetTitleBlock().GetTitle();
if( !msg.IsEmpty() )
{
plotter->text( pos, color,
plotter->Text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size1_5,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
@ -343,13 +343,13 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg = GetTitleBlock().GetComment1();
if( !msg.IsEmpty() )
{
plotter->text( pos, color,
plotter->Text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
pos.x = (pageInfo.GetLeftMarginMils() + 1260) * conv_unit;
pos.y = (pageInfo.GetTopMarginMils() + 270) * conv_unit;
plotter->text( pos, color,
pos.x = (pageInfo.GetLeftMarginMils() + 1260) * iusPerMil;
pos.y = (pageInfo.GetTopMarginMils() + 270) * iusPerMil;
plotter->Text( pos, color,
msg.GetData(), 1800, text_size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
@ -360,7 +360,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg = GetTitleBlock().GetComment2();
if( !msg.IsEmpty() )
{
plotter->text( pos, color,
plotter->Text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
@ -371,7 +371,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg = GetTitleBlock().GetComment3();
if( !msg.IsEmpty() )
{
plotter->text( pos, color,
plotter->Text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
@ -382,7 +382,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg = GetTitleBlock().GetComment4();
if( !msg.IsEmpty() )
{
plotter->text( pos, color,
plotter->Text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
@ -392,10 +392,10 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
case WS_UPPER_SEGMENT:
case WS_LEFT_SEGMENT:
case WS_SEGMENT:
plotter->move_to( pos );
pos.x = ( ref.x - WsItem->m_Endx ) * conv_unit;
pos.y = ( ref.y - WsItem->m_Endy ) * conv_unit;
plotter->finish_to( pos );
plotter->MoveTo( pos );
pos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil;
pos.y = ( ref.y - WsItem->m_Endy ) * iusPerMil;
plotter->FinishTo( pos );
break;
}
}
@ -406,8 +406,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = ( ref.x - WsItem->m_Posx ) * conv_unit;
pos.y = ( ref.y - WsItem->m_Posy ) * conv_unit;
pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil;
pos.y = ( ref.y - WsItem->m_Posy ) * iusPerMil;
msg.Empty();
switch( WsItem->m_Type )
@ -417,13 +417,13 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg = GetTitleBlock().GetComment1();
if( !msg.IsEmpty() )
{
plotter->text( pos, color,
plotter->Text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
pos.x = (pageInfo.GetLeftMarginMils() + 1260) * conv_unit;
pos.y = (pageInfo.GetTopMarginMils() + 270) * conv_unit;
plotter->text( pos, color,
pos.x = (pageInfo.GetLeftMarginMils() + 1260) * iusPerMil;
pos.y = (pageInfo.GetTopMarginMils() + 270) * iusPerMil;
plotter->Text( pos, color,
msg, 1800, text_size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
@ -433,7 +433,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
case WS_PODPIS_D:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
plotter->Text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
break;
@ -442,17 +442,17 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << screen->m_ScreenNumber;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
plotter->Text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
break;
case WS_LEFT_SEGMENT_D:
case WS_SEGMENT_D:
plotter->move_to( pos );
pos.x = ( ref.x - WsItem->m_Endx ) * conv_unit;
pos.y = ( ref.y - WsItem->m_Endy ) * conv_unit;
plotter->finish_to( pos );
plotter->MoveTo( pos );
pos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil;
pos.y = ( ref.y - WsItem->m_Endy ) * iusPerMil;
plotter->FinishTo( pos );
break;
}
}
@ -467,8 +467,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = ( ref.x - WsItem->m_Posx ) * conv_unit;
pos.y = ( ref.y - WsItem->m_Posy ) * conv_unit;
pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil;
pos.y = ( ref.y - WsItem->m_Posy ) * iusPerMil;
bold = false;
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
@ -497,7 +497,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
case WS_IDENTSHEET:
msg << screen->m_ScreenNumber << wxT( "/" ) <<
screen->m_NumberOfScreen;
screen->m_NumberOfScreens;
break;
case WS_FILENAME:
@ -558,22 +558,22 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
case WS_LEFT_SEGMENT:
WS_MostUpperLine.m_Posy = WS_MostUpperLine.m_Endy
= WS_MostLeftLine.m_Posy = UpperLimit;
pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
pos.y = (ref.y - WsItem->m_Posy) * iusPerMil;
case WS_SEGMENT:
{
wxPoint auxpos;
auxpos.x = ( ref.x - WsItem->m_Endx ) * conv_unit;
auxpos.y = ( ref.y - WsItem->m_Endy ) * conv_unit;
plotter->move_to( pos );
plotter->finish_to( auxpos );
auxpos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil;
auxpos.y = ( ref.y - WsItem->m_Endy ) * iusPerMil;
plotter->MoveTo( pos );
plotter->FinishTo( auxpos );
}
break;
}
if( !msg.IsEmpty() )
{
plotter->text( pos, color,
plotter->Text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, bold );

View File

@ -59,7 +59,7 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
info.SetAppName( wxT( ".: " ) + wxGetApp().GetTitle() + wxT( " :." ) );
/* Copyright information */
info.SetCopyright( wxT( "(C) 1992-2011 KiCad Developers Team" ) );
info.SetCopyright( wxT( "(C) 1992-2012 KiCad Developers Team" ) );
/* KiCad build version */
wxString version;
@ -147,8 +147,8 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
HtmlHyperlink( wxT( "https://launchpad.net/kicad" ), _( "Project on Launchpad" ) ) << wxT(
"</li>" );
description << wxT( "<li>" ) <<
HtmlHyperlink( wxT( "http://kicad.sourceforge.net" ),
_( "Wiki on Sourceforge with many information" ) ) << wxT( "</li>" );
HtmlHyperlink( wxT( "http://www.kicad-pcb.org" ),
_( "The new KiCad site" ) ) << wxT( "</li>" );
description << wxT( "<li>" ) <<
HtmlHyperlink( wxT( "http://www.kicadlib.org" ),
_( "Repository with additional component libraries" ) ) << wxT( "</li>" );

View File

@ -58,7 +58,7 @@ dialog_about_base::dialog_about_base( wxWindow* parent, wxWindowID id, const wxS
bSizer1->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_auiNotebook = new wxAuiNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_SCROLL_BUTTONS|wxAUI_NB_TAB_FIXED_WIDTH );
m_auiNotebook->SetMinSize( wxSize( 550,300 ) );
m_auiNotebook->SetMinSize( wxSize( 750,350 ) );
bSizer1->Add( m_auiNotebook, 2, wxEXPAND | wxALL, 5 );

View File

@ -37,7 +37,7 @@
<property name="minimum_size">-1,-1</property>
<property name="name">dialog_about_base</property>
<property name="pos"></property>
<property name="size">510,434</property>
<property name="size">750,450</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSTAY_ON_TOP</property>
<property name="subclass"></property>
<property name="title">About...</property>
@ -472,7 +472,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">550,300</property>
<property name="minimum_size">750,350</property>
<property name="name">m_auiNotebook</property>
<property name="permission">protected</property>
<property name="pos"></property>

View File

@ -53,7 +53,7 @@ class dialog_about_base : public wxDialog
public:
dialog_about_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About..."), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 510,434 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSTAY_ON_TOP );
dialog_about_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About..."), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 750,350 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSTAY_ON_TOP );
~dialog_about_base();
};

View File

@ -40,10 +40,6 @@ DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& titl
#include <base_struct.h> // EDA_RECT
#include <typeinfo>
/// hashtable with key: C string and value: EDA_RECT.
/// The key is the classname of the derived wxformbuilder dialog
WX_DECLARE_HASH_MAP( char*, EDA_RECT, wxStringHash, wxStringEqual, RECT_MAP );
static RECT_MAP class_map;
bool DIALOG_SHIM::Show( bool show )

View File

@ -132,7 +132,7 @@ void DIALOG_PAGES_SETTINGS::initDialog()
#ifdef EESCHEMA
// Init display value for sheet User size
wxString format = m_TextSheetCount->GetLabel();
msg.Printf( format, m_Screen->m_NumberOfScreen );
msg.Printf( format, m_Screen->m_NumberOfScreens );
m_TextSheetCount->SetLabel( msg );
format = m_TextSheetNumber->GetLabel();
@ -644,7 +644,7 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
GRResetPenAndBrush( ( wxDC* ) &memDC );
m_Parent->TraceWorkSheet( (wxDC*) &memDC, dummySize, pointLeftTop, pointRightBottom,
emptyString, emptyString, m_tb, m_Screen->m_NumberOfScreen,
emptyString, emptyString, m_tb, m_Screen->m_NumberOfScreens,
m_Screen->m_ScreenNumber, 1, appScale, LIGHTGRAY, RED );
memDC.SelectObject( wxNullBitmap );

View File

@ -44,7 +44,7 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
wxSize( 300, 200 ), 0, NULL,
wxLB_NEEDED_SB | wxLB_SINGLE | wxLB_HSCROLL );
GeneralBoxSizer->Add( m_listBox, 0, wxGROW | wxALL, 5 );
GeneralBoxSizer->Add( m_listBox, 2, wxGROW | wxALL, 5 );
InsertItems( aItemList, 0 );
@ -54,7 +54,7 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
wxDefaultPosition, wxSize( -1, 60 ),
wxTE_READONLY | wxTE_MULTILINE );
GeneralBoxSizer->Add( m_messages, 0, wxGROW | wxALL, 5 );
GeneralBoxSizer->Add( m_messages, 1, wxGROW | wxALL, 5 );
}
wxSizer* buttonSizer = CreateButtonSizer( wxOK | wxCANCEL );

View File

@ -88,8 +88,6 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti
const wxPoint& pos, const wxSize& size, long style ) :
EDA_BASE_FRAME( father, idtype, title, pos, size, style )
{
wxSize minsize;
m_drawToolBar = NULL;
m_optionsToolBar = NULL;
m_gridSelectBox = NULL;
@ -110,27 +108,43 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti
m_GridColor = DARKGRAY; // Grid color
m_snapToGrid = true;
// Internal units per inch: = 1000 for schema, = 10000 for PCB
minsize.x = 470;
minsize.y = 350 + m_MsgFrameHeight;
// Pane sizes for status bar.
// @todo these should be sized based on typical text content, like
// "dx -10.123 -10.123 dy -10.123 -10.123" using the system font which is
// in play on a particular platform, and should not be constants.
// Please do not reduce these constant values, and please use dynamic
// system font specific sizing in the future.
#define ZOOM_DISPLAY_SIZE 60
#define COORD_DISPLAY_SIZE 165
#define DELTA_DISPLAY_SIZE 245
#define UNITS_DISPLAY_SIZE 65
//#define ZOOM_DISPLAY_SIZE 60
//#define COORD_DISPLAY_SIZE 165
//#define DELTA_DISPLAY_SIZE 245
//#define UNITS_DISPLAY_SIZE 65
#define FUNCTION_DISPLAY_SIZE 110
static const int dims[6] = { -1, ZOOM_DISPLAY_SIZE,
COORD_DISPLAY_SIZE, DELTA_DISPLAY_SIZE,
UNITS_DISPLAY_SIZE, FUNCTION_DISPLAY_SIZE };
CreateStatusBar( 6 );
SetStatusWidths( 6, dims );
// set the size of the status bar subwindows:
wxWindow* stsbar = GetStatusBar();
int dims[] = {
// balance of status bar on far left is set to a default or whatever is left over.
-1,
// When using GetTextSize() remember the width of '1' is not the same
// as the width of '0' unless the font is fixed width, and it usually won't be.
// zoom:
GetTextSize( wxT( "Z 762000" ), stsbar ).x + 10,
// cursor coords
GetTextSize( wxT( "X 0234.567890 Y 0234.567890" ), stsbar ).x + 10,
// delta distances
GetTextSize( wxT( "dx 0234.567890 dx 0234.567890 d 0234.567890" ), stsbar ).x + 10,
// units display, Inches is bigger than mm
GetTextSize( _( "Inches" ), stsbar ).x + 10,
FUNCTION_DISPLAY_SIZE,
};
SetStatusWidths( DIM( dims ), dims );
// Create child subwindows.
GetClientSize( &m_FrameSize.x, &m_FrameSize.y );
@ -380,7 +394,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
}
double EDA_DRAW_FRAME::GetZoom( void )
double EDA_DRAW_FRAME::GetZoom()
{
return GetScreen()->GetZoom();
}
@ -414,11 +428,11 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg()
break;
case MILLIMETRES:
msg += _( "mm" );
msg = _( "mm" );
break;
default:
msg += _( "Units" );
msg = _( "Units" );
break;
}
@ -661,6 +675,16 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosi
}
// See comment in classpcb.cpp near line 66
//static const double MAX_AXIS = 1518500251;
// However I am not seeing a problem with this size yet:
static const double MAX_AXIS = INT_MAX - 100;
#define VIRT_MIN (-MAX_AXIS/2.0) ///< min X or Y coordinate in virtual space
#define VIRT_MAX (MAX_AXIS/2.0) ///< max X or Y coordinate in virtual space
void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
{
BASE_SCREEN* screen = GetScreen();
@ -673,7 +697,7 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
double scale = screen->GetScalingFactor();
wxLogTrace( traceScrollSettings, wxT( "Center Position = ( %d, %d ), scale = %.16g" ),
wxLogTrace( traceScrollSettings, wxT( "Center Position = ( %d, %d ), scale = %.10g" ),
aCenterPositionIU.x, aCenterPositionIU.y, scale );
// Calculate the portion of the drawing that can be displayed in the
@ -701,6 +725,29 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
}
DBOX clientRectIU( xIU, yIU, clientSizeIU.x, clientSizeIU.y );
wxPoint centerPositionIU;
#if 1 || defined( USE_PCBNEW_NANOMETRES )
// put "int" limits on the clientRect
if( clientRectIU.GetLeft() < VIRT_MIN )
clientRectIU.MoveLeftTo( VIRT_MIN );
if( clientRectIU.GetTop() < VIRT_MIN )
clientRectIU.MoveTopTo( VIRT_MIN );
if( clientRectIU.GetRight() > VIRT_MAX )
clientRectIU.MoveRightTo( VIRT_MAX );
if( clientRectIU.GetBottom() > VIRT_MAX )
clientRectIU.MoveBottomTo( VIRT_MAX );
#endif
centerPositionIU.x = KiROUND( clientRectIU.x + clientRectIU.width/2 );
centerPositionIU.y = KiROUND( clientRectIU.y + clientRectIU.height/2 );
if( screen->m_Center )
{
centerPositionIU.x -= KiROUND( pageRectIU.width / 2.0 );
centerPositionIU.y -= KiROUND( pageRectIU.height / 2.0 );
}
DSIZE virtualSizeIU;
if( pageRectIU.GetLeft() < clientRectIU.GetLeft() && pageRectIU.GetRight() > clientRectIU.GetRight() )
@ -709,26 +756,24 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
}
else
{
double drawingCenterX = pageRectIU.x + ( pageRectIU.width / 2 );
double pageCenterX = pageRectIU.x + ( pageRectIU.width / 2 );
double clientCenterX = clientRectIU.x + ( clientRectIU.width / 2 );
if( clientRectIU.width > pageRectIU.width )
{
if( drawingCenterX > clientCenterX )
virtualSizeIU.x = ( drawingCenterX - clientRectIU.GetLeft() ) * 2;
else if( drawingCenterX < clientCenterX )
virtualSizeIU.x = ( clientRectIU.GetRight() - drawingCenterX ) * 2;
if( pageCenterX > clientCenterX )
virtualSizeIU.x = ( pageCenterX - clientRectIU.GetLeft() ) * 2;
else if( pageCenterX < clientCenterX )
virtualSizeIU.x = ( clientRectIU.GetRight() - pageCenterX ) * 2;
else
virtualSizeIU.x = clientRectIU.width;
}
else
{
if( drawingCenterX > clientCenterX )
virtualSizeIU.x = pageRectIU.width +
( (pageRectIU.GetLeft() - clientRectIU.GetLeft() ) * 2 );
else if( drawingCenterX < clientCenterX )
virtualSizeIU.x = pageRectIU.width +
( (clientRectIU.GetRight() - pageRectIU.GetRight() ) * 2 );
if( pageCenterX > clientCenterX )
virtualSizeIU.x = pageRectIU.width + ( (pageRectIU.GetLeft() - clientRectIU.GetLeft() ) * 2 );
else if( pageCenterX < clientCenterX )
virtualSizeIU.x = pageRectIU.width + ( (clientRectIU.GetRight() - pageRectIU.GetRight() ) * 2 );
else
virtualSizeIU.x = pageRectIU.width;
}
@ -740,24 +785,24 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
}
else
{
int drawingCenterY = pageRectIU.y + ( pageRectIU.height / 2 );
int clientCenterY = clientRectIU.y + ( clientRectIU.height / 2 );
double pageCenterY = pageRectIU.y + ( pageRectIU.height / 2 );
double clientCenterY = clientRectIU.y + ( clientRectIU.height / 2 );
if( clientRectIU.height > pageRectIU.height )
{
if( drawingCenterY > clientCenterY )
virtualSizeIU.y = ( drawingCenterY - clientRectIU.GetTop() ) * 2;
else if( drawingCenterY < clientCenterY )
virtualSizeIU.y = ( clientRectIU.GetBottom() - drawingCenterY ) * 2;
if( pageCenterY > clientCenterY )
virtualSizeIU.y = ( pageCenterY - clientRectIU.GetTop() ) * 2;
else if( pageCenterY < clientCenterY )
virtualSizeIU.y = ( clientRectIU.GetBottom() - pageCenterY ) * 2;
else
virtualSizeIU.y = clientRectIU.height;
}
else
{
if( drawingCenterY > clientCenterY )
if( pageCenterY > clientCenterY )
virtualSizeIU.y = pageRectIU.height +
( ( pageRectIU.GetTop() - clientRectIU.GetTop() ) * 2 );
else if( drawingCenterY < clientCenterY )
else if( pageCenterY < clientCenterY )
virtualSizeIU.y = pageRectIU.height +
( ( clientRectIU.GetBottom() - pageRectIU.GetBottom() ) * 2 );
else
@ -765,6 +810,12 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
}
}
#if 1 || defined( USE_PCBNEW_NANOMETRES )
// put "int" limits on the virtualSizeIU
virtualSizeIU.x = std::min( virtualSizeIU.x, MAX_AXIS );
virtualSizeIU.y = std::min( virtualSizeIU.y, MAX_AXIS );
#endif
if( screen->m_Center )
{
screen->m_DrawOrg.x = -KiROUND( virtualSizeIU.x / 2.0 );
@ -790,10 +841,10 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
// Calculate the scroll bar position in internal units to place the
// center position at the center of client rectangle.
screen->SetScrollCenterPosition( aCenterPositionIU );
screen->SetScrollCenterPosition( centerPositionIU );
double posX = aCenterPositionIU.x - clientRectIU.width /2.0 - screen->m_DrawOrg.x;
double posY = aCenterPositionIU.y - clientRectIU.height/2.0 - screen->m_DrawOrg.y;
double posX = centerPositionIU.x - clientRectIU.width /2.0 - screen->m_DrawOrg.x;
double posY = centerPositionIU.y - clientRectIU.height/2.0 - screen->m_DrawOrg.y;
// Convert scroll bar position to device units.
posX = KiROUND( posX * scale );
@ -801,25 +852,25 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
if( posX < 0 )
{
wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %d" ), posX );
wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
posX = 0;
}
if( posX > unitsX )
{
wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %d" ), posX );
wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
posX = unitsX;
}
if( posY < 0 )
{
wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %d" ), posY );
wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
posY = 0;
}
if( posY > unitsY )
{
wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %d" ), posY );
wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
posY = unitsY;
}
@ -827,7 +878,7 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
screen->m_ScrollbarNumber = wxSize( KiROUND( unitsX ), KiROUND( unitsY ) );
wxLogTrace( traceScrollSettings,
wxT( "Drawing = (%.16g, %.16g), Client = (%.16g, %.16g), Offset = (%d, %d), SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
wxT( "Drawing = (%.10g, %.10g), Client = (%.10g, %.10g), Offset = (%d, %d), SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
virtualSizeIU.x, virtualSizeIU.y, clientSizeIU.x, clientSizeIU.y,
screen->m_DrawOrg.x, screen->m_DrawOrg.y,
screen->m_ScrollPixelsPerUnitX, screen->m_ScrollPixelsPerUnitY,
@ -843,4 +894,3 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
screen->m_ScrollbarPos.x,
screen->m_ScrollbarPos.y, noRefresh );
}

View File

@ -39,7 +39,7 @@
#include <kicad_device_context.h>
#define CURSOR_SIZE 12 // Cursor size in pixels
static const int CURSOR_SIZE = 12; ///< Cursor size in pixels
#define CLIP_BOX_PADDING 2
@ -207,13 +207,13 @@ void EDA_DRAW_PANEL::CrossHairOn( wxDC* DC )
}
int EDA_DRAW_PANEL::GetZoom()
double EDA_DRAW_PANEL::GetZoom()
{
return GetScreen()->GetZoom();
}
void EDA_DRAW_PANEL::SetZoom( int zoom )
void EDA_DRAW_PANEL::SetZoom( double zoom )
{
GetScreen()->SetZoom( zoom );
}

View File

@ -164,13 +164,13 @@ static void DrawGraphicTextPline(
{
if( aPlotter )
{
aPlotter->move_to( coord[0] );
aPlotter->MoveTo( coord[0] );
for( int ik = 1; ik < point_count; ik++ )
{
aPlotter->line_to( coord[ik] );
aPlotter->LineTo( coord[ik] );
}
aPlotter->pen_finish();
aPlotter->PenFinish();
}
else if( aCallback )
{
@ -357,8 +357,8 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
if( aPlotter )
{
aPlotter->move_to( current_char_pos );
aPlotter->finish_to( end );
aPlotter->MoveTo( current_char_pos );
aPlotter->FinishTo( end );
}
else if( aCallback )
{
@ -515,7 +515,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
* @param aItalic = true to simulate an italic font
* @param aBold = true to use a bold font Useful only with default width value (aWidth = 0)
*/
void PLOTTER::text( const wxPoint& aPos,
void PLOTTER::Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
@ -534,11 +534,11 @@ void PLOTTER::text( const wxPoint& aPos,
else
aWidth = -Clamp_Text_PenSize( -aWidth, aSize, aBold );
set_current_line_width( aWidth );
SetCurrentLineWidth( aWidth );
if( aColor >= 0 )
set_color( aColor );
SetColor( aColor );
DrawGraphicText( NULL, NULL, aPos, aColor, aText,
aOrient, aSize,

View File

@ -51,7 +51,9 @@ static int compare( const void* a1, const void* a2 )
void DSNLEXER::init()
{
curTok = DSN_NONE;
curTok = DSN_NONE;
prevTok = DSN_NONE;
stringDelimiter = '"';
specctraMode = false;
@ -433,6 +435,22 @@ L_read:
if( cur >= limit )
goto L_read;
if( *cur == '(' )
{
curText = *cur;
curTok = DSN_LEFT;
head = cur+1;
goto exit;
}
if( *cur == ')' )
{
curText = *cur;
curTok = DSN_RIGHT;
head = cur+1;
goto exit;
}
// switching the string_quote character
if( prevTok == DSN_STRING_QUOTE )
{
@ -462,22 +480,6 @@ L_read:
goto exit;
}
if( *cur == '(' )
{
curText = *cur;
curTok = DSN_LEFT;
head = cur+1;
goto exit;
}
if( *cur == ')' )
{
curText = *cur;
curTok = DSN_RIGHT;
head = cur+1;
goto exit;
}
/* get the dash out of a <pin_reference> which is embedded for example
like: U2-14 or "U2"-"14"
This is detectable by a non-space immediately preceeding the dash.

View File

@ -1026,7 +1026,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineW
wxString paper = pageInfo.GetType();
wxString file = aScreen->GetFileName();
TITLE_BLOCK t_block = GetTitleBlock();
int number_of_screens = aScreen->m_NumberOfScreen;
int number_of_screens = aScreen->m_NumberOfScreens;
int screen_to_draw = aScreen->m_ScreenNumber;
TraceWorkSheet( aDC, pageSize, margin_left_top, margin_right_bottom,
@ -1657,7 +1657,7 @@ wxString EDA_DRAW_FRAME::GetScreenDesc()
wxString msg;
msg << GetScreen()->m_ScreenNumber << wxT( "/" )
<< GetScreen()->m_NumberOfScreen;
<< GetScreen()->m_NumberOfScreens;
return msg;
}

View File

@ -59,7 +59,13 @@ void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
{
BASE_SCREEN* screen = GetScreen();
screen->SetZoom( BestZoom() ); // Set the best zoom and get center point.
// Set the best zoom and get center point.
// BestZoom() can compute an illegal zoom if the client window size
// is small, say because frame is not maximized. So use the clamping form
// of SetZoom():
double bestzoom = BestZoom();
screen->SetScalingFactor( bestzoom );
if( screen->m_FirstRedraw )
screen->SetCrossHairPosition( screen->GetScrollCenterPosition() );
@ -151,7 +157,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
i = id - ID_POPUP_ZOOM_LEVEL_START;
if( i >= screen->m_ZoomList.GetCount() )
if( i >= screen->m_ZoomList.size() )
{
wxLogDebug( wxT( "%s %d: index %d is outside the bounds of the zoom list." ),
__TFILE__, __LINE__, i );
@ -194,8 +200,8 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
zoom = screen->GetZoom();
maxZoomIds = ID_POPUP_ZOOM_LEVEL_END - ID_POPUP_ZOOM_LEVEL_START;
maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.GetCount() ) ?
maxZoomIds : screen->m_ZoomList.GetCount();
maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
maxZoomIds : screen->m_ZoomList.size();
// Populate zoom submenu.
for( int i = 0; i < maxZoomIds; i++ )

View File

@ -66,7 +66,8 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
{
fn = m_AliasLibNames[ii];
if( !fn.HasExt() ) {
if( !fn.HasExt() )
{
fn.SetExt( FootprintAliasFileExtension );
// above fails if filename have more than one point
}
@ -124,8 +125,8 @@ found in the default search paths." ),
msg.Printf( _( "%d footprint aliases found." ), aliases.size() );
SetStatusText( msg, 0 );
m_skipComponentSelect = true;
ii = 0;
BOOST_FOREACH( COMPONENT_INFO& component, m_components )
{
bool found = false;
@ -180,4 +181,5 @@ any of the project footprint libraries." ),
}
}
}
m_skipComponentSelect = false;
}

View File

@ -280,7 +280,8 @@ void FOOTPRINTS_LISTBOX::OnLeftClick( wxListEvent& event )
wxASSERT(Module);
if( GetParent()->m_DisplayFootprintFrame )
{
GetParent()->CreateScreenCmp(); /* refresh general */
// Refresh current selected footprint view:
GetParent()->CreateScreenCmp();
}
if( Module )

View File

@ -116,6 +116,7 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
m_isEESchemaNetlist = false;
m_KeepCvpcbOpen = false;
m_undefinedComponentCnt = 0;
m_skipComponentSelect = false;
/* Name of the document footprint list
* usually located in share/modules/footprints_doc
@ -406,6 +407,7 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
if( IsOK( this, _( "Delete selections" ) ) )
{
m_skipComponentSelect = true;
m_ListCmp->SetSelection( 0 );
BOOST_FOREACH( COMPONENT_INFO & component, m_components )
@ -414,6 +416,7 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
SetNewPkg( wxEmptyString );
}
m_skipComponentSelect = false;
m_ListCmp->SetSelection( 0 );
m_undefinedComponentCnt = m_components.size();
}
@ -506,18 +509,22 @@ void CVPCB_MAINFRAME::OnLeftDClick( wxListEvent& event )
/* Called when clicking on a component in component list window
* * Updates the filtered foorprint list, if the filtered list option is selected
* * Updates the filtered footprint list, if the filtered list option is selected
* * Updates the current selected footprint in footprint list
* * Updates the footprint shown in footprint display window (if opened)
*/
void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
{
if( m_skipComponentSelect )
return;
#define REDRAW_LIST true
#define SELECT_FULL_LIST true
int selection = -1;
if( !m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST )
&& !m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ))
&& !m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST )
)
m_FootprintList->SetActiveFootprintList( SELECT_FULL_LIST, REDRAW_LIST );
else
@ -553,36 +560,41 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
return;
// Preview of the already assigned footprint.
// Find the footprint that was already choosen for this component and select it.
wxString module = *(&m_components[ selection ].m_Footprint);
// Find the footprint that was already choosen for this component and select it,
// but only if the selection is made from the component list.
// If the selection is made from the footprint list, do not change the current selected footprint.
bool found = false;
for( int ii = 0; ii < m_FootprintList->GetCount(); ii++ )
if( FindFocus() == m_ListCmp )
{
wxString footprintName;
wxString msg = (*m_FootprintList->m_ActiveFootprintList)[ii];
msg.Trim( true );
msg.Trim( false );
footprintName = msg.AfterFirst( wxChar( ' ' ) );
wxString module = *(&m_components[ selection ].m_Footprint);
if( module.Cmp( footprintName ) == 0 )
bool found = false;
for( int ii = 0; ii < m_FootprintList->GetCount(); ii++ )
{
m_FootprintList->SetSelection( ii, true );
found = true;
break;
wxString footprintName;
wxString msg = (*m_FootprintList->m_ActiveFootprintList)[ii];
msg.Trim( true );
msg.Trim( false );
footprintName = msg.AfterFirst( wxChar( ' ' ) );
if( module.Cmp( footprintName ) == 0 )
{
m_FootprintList->SetSelection( ii, true );
found = true;
break;
}
}
if( ! found )
{
int ii = m_FootprintList->GetSelection();
if ( ii >= 0 )
m_FootprintList->SetSelection( ii, false );
if( m_DisplayFootprintFrame )
{
CreateScreenCmp();
}
}
}
if( ! found )
{
int ii = m_FootprintList->GetSelection();
if ( ii >= 0 )
m_FootprintList->SetSelection( ii, false );
if( m_DisplayFootprintFrame )
{
CreateScreenCmp();
}
}
SendMessageToEESCHEMA();
DisplayStatus();

View File

@ -46,6 +46,8 @@ protected:
int m_undefinedComponentCnt;
bool m_modified;
bool m_isEESchemaNetlist;
bool m_skipComponentSelect; // true to skip OnSelectComponent event
// (in automatic selection/deletion of associations)
PARAM_CFG_ARRAY m_projectFileParams;
public:

View File

@ -59,6 +59,7 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
if( footprint )
{
footprint->SetParent( GetBoard() );
footprint->SetPosition( wxPoint( 0, 0 ) );
return footprint;
}

View File

@ -68,7 +68,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
netList_Reader.m_UseCmpFile = false;
netList_Reader.SetFilesnames( m_NetlistFileName.GetFullPath(), wxEmptyString );
// True to read footprint filters section: true for CvPcb, false pro Pcbnew
// True to read footprint filters section: true for CvPcb, false for Pcbnew
netList_Reader.ReadLibpartSectionSetOpt( true );
bool success = netList_Reader.ReadNetList( netfile );
@ -79,9 +79,15 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
}
// Now copy footprints info into Cvpcb list:
// We also remove footprint name if it is "$noname"
// because this is a dummy name,, not an actual name
COMPONENT_INFO_LIST& cmpInfo = netList_Reader.GetComponentInfoList();
for( unsigned ii = 0; ii < cmpInfo.size(); ii++ )
{
m_components.push_back( cmpInfo[ii] );
if( cmpInfo[ii]->m_Footprint == wxT( "$noname" ) )
cmpInfo[ii]->m_Footprint.Empty();
}
cmpInfo.clear(); // cmpInfo is no more owner of the list.
// Sort components by reference:

View File

@ -36,6 +36,8 @@ set(EESCHEMA_SRCS
dialogs/dialog_plot_schematic_HPGL_base.cpp
dialogs/dialog_plot_schematic_PS.cpp
dialogs/dialog_plot_schematic_PS_base.cpp
dialogs/dialog_plot_schematic_PDF.cpp
dialogs/dialog_plot_schematic_PDF_base.cpp
dialogs/annotate_dialog.cpp
dialogs/dialog_annotate_base.cpp
dialogs/dialog_lib_edit_text.cpp

View File

@ -66,7 +66,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
int SCH_EDIT_FRAME::ReturnBlockCommand( int key )
{
int cmd;
int cmd = BLOCK_IDLE;
switch( key )
{
@ -78,11 +78,14 @@ int SCH_EDIT_FRAME::ReturnBlockCommand( int key )
cmd = BLOCK_MOVE;
break;
case GR_KB_ALT:
case GR_KB_SHIFT:
cmd = BLOCK_COPY;
break;
case GR_KB_ALT:
cmd = BLOCK_ROTATE;
break;
case GR_KB_CTRL:
cmd = BLOCK_DRAG;
break;
@ -130,12 +133,6 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
switch( block->GetCommand() )
{
case BLOCK_IDLE:
break;
case BLOCK_ROTATE:
case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y:
case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */
if( m_canvas->IsMouseCaptured() )
@ -167,13 +164,8 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
block->ClearItemsList();
break;
case BLOCK_ZOOM: // Handled by HandleBlockEnd()
case BLOCK_DELETE:
case BLOCK_SAVE:
case BLOCK_FLIP:
case BLOCK_ABORT:
case BLOCK_SELECT_ITEMS_ONLY:
break;
default: // others are handled by HandleBlockEnd()
break;
}
OnModify();
@ -225,15 +217,31 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
DisplayError( this, wxT( "Error in HandleBlockPLace()" ) );
break;
case BLOCK_ROTATE:
GetScreen()->UpdatePickList();
DrawAndSizingBlockOutlines( m_canvas, DC, wxDefaultPosition, false );
if( block->GetCount() )
{
// Compute the rotation center and put it on grid:
wxPoint rotationPoint = block->Centre();
rotationPoint = GetScreen()->GetNearestGridPosition( rotationPoint );
GetScreen()->SetCrossHairPosition( rotationPoint );
SaveCopyInUndoList( block->GetItems(), UR_ROTATED, rotationPoint );
RotateListOfItems( block->GetItems(), rotationPoint );
OnModify();
}
block->ClearItemsList();
GetScreen()->TestDanglingEnds( m_canvas, DC );
m_canvas->Refresh();
break;
case BLOCK_DRAG: /* Drag */
GetScreen()->BreakSegmentsOnJunctions();
// fall through
case BLOCK_ROTATE:
case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y:
case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */
case BLOCK_MOVE:
case BLOCK_COPY:
GetScreen()->UpdatePickList();
// fall through
@ -263,7 +271,6 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
DeleteItemsInList( m_canvas, block->GetItems() );
OnModify();
}
block->ClearItemsList();
GetScreen()->TestDanglingEnds( m_canvas, DC );
m_canvas->Refresh();
@ -291,9 +298,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
zoom_command = true;
break;
case BLOCK_FLIP: /* Pcbnew only! */
case BLOCK_SELECT_ITEMS_ONLY: /* Not used */
case BLOCK_ABORT: /* not executed here */
default:
break;
}
}

View File

@ -44,7 +44,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
int LIB_EDIT_FRAME::ReturnBlockCommand( int key )
{
int cmd;
int cmd = BLOCK_IDLE;
switch( key )
{
@ -60,11 +60,14 @@ int LIB_EDIT_FRAME::ReturnBlockCommand( int key )
cmd = BLOCK_MOVE;
break;
case GR_KB_ALT:
case GR_KB_SHIFT:
cmd = BLOCK_COPY;
break;
case GR_KB_ALT:
cmd = BLOCK_ROTATE;
break;
case GR_KB_SHIFTCTRL:
cmd = BLOCK_DELETE;
break;
@ -168,7 +171,8 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
SaveCopyInUndoList( m_component );
pt = GetScreen()->m_BlockLocate.Centre();
pt.y *= -1;
pt = GetScreen()->GetNearestGridPosition( pt );
NEGATE( pt.y );
if ( m_component )
{
@ -253,7 +257,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
SaveCopyInUndoList( m_component );
pt = GetScreen()->m_BlockLocate.GetMoveVector();
pt.y *= -1;
NEGATE( pt.y );
if ( m_component )
m_component->CopySelectedItems( pt );
@ -271,7 +275,8 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
SaveCopyInUndoList( m_component );
pt = GetScreen()->m_BlockLocate.Centre();
pt.y *= -1;
pt = GetScreen()->GetNearestGridPosition( pt );
NEGATE( pt.y );
if ( m_component )
{

View File

@ -391,8 +391,8 @@ void LIB_COMPONENT::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
continue;
aPlotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
bool fill = aPlotter->get_color_mode();
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) );
bool fill = aPlotter->GetColorMode();
item.Plot( aPlotter, aOffset, fill, aTransform );
}
@ -968,8 +968,10 @@ EDA_RECT LIB_COMPONENT::GetBoundingBox( int aUnit, int aConvert ) const
{
EDA_RECT bBox( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
BOOST_FOREACH( const LIB_ITEM& item, drawings )
for( unsigned ii = 0; ii < drawings.size(); ii++ )
{
const LIB_ITEM& item = drawings[ii];
if( ( item.m_Unit > 0 ) && ( ( m_unitCount > 1 ) && ( aUnit > 0 )
&& ( aUnit != item.m_Unit ) ) )
continue;
@ -991,8 +993,10 @@ EDA_RECT LIB_COMPONENT::GetBodyBoundingBox( int aUnit, int aConvert ) const
{
EDA_RECT bBox( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
BOOST_FOREACH( const LIB_ITEM& item, drawings )
for( unsigned ii = 0; ii < drawings.size(); ii++ )
{
const LIB_ITEM& item = drawings[ii];
if( ( item.m_Unit > 0 ) && ( ( m_unitCount > 1 ) && ( aUnit > 0 )
&& ( aUnit != item.m_Unit ) ) )
continue;
@ -1187,8 +1191,9 @@ void LIB_COMPONENT::RemoveDuplicateDrawItems()
bool LIB_COMPONENT::HasConversion() const
{
BOOST_FOREACH( const LIB_ITEM& item, drawings )
for( unsigned ii = 0; ii < drawings.size(); ii++ )
{
const LIB_ITEM& item = drawings[ii];
if( item.m_Convert > 1 )
return true;
}

View File

@ -91,6 +91,7 @@ class CMP_LIBRARY
{
int type; ///< Library type indicator.
wxFileName fileName; ///< Library file name.
// ZZZ why this a wxDateTime where others are time_t?
wxDateTime timeStamp; ///< Library save time and date.
int versionMajor; ///< Library major version number.
int versionMinor; ///< Library minor version number.

View File

@ -236,25 +236,27 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
}
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::CopyDocToAlias( wxCommandEvent& event )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::CopyDocFromRootToAlias( wxCommandEvent& event )
{
if( m_Parent == NULL )
return;
LIB_ALIAS* alias;
LIB_ALIAS* parent_alias;
LIB_COMPONENT* component = m_Parent->GetComponent();
if( component == NULL )
return;
alias = component->GetAlias( m_Parent->GetAliasName() );
// search for the main alias: this is the first alias in alias list
// something like the main component
parent_alias = component->GetAlias( 0 );
if( alias == NULL )
if( parent_alias == NULL ) // Should never occur (bug)
return;
m_DocCtrl->SetValue( alias->GetDescription() );
m_DocfileCtrl->SetValue( alias->GetDocFileName() );
m_KeywordsCtrl->SetValue( alias->GetKeyWords() );
m_DocCtrl->SetValue( parent_alias->GetDescription() );
m_DocfileCtrl->SetValue( parent_alias->GetDocFileName() );
m_KeywordsCtrl->SetValue( parent_alias->GetKeyWords() );
}

View File

@ -34,7 +34,7 @@ private:
void AddAliasOfPart(wxCommandEvent& event);
bool ChangeNbUnitsPerPackage(int newUnit);
bool SetUnsetConvert();
void CopyDocToAlias(wxCommandEvent& event);
void CopyDocFromRootToAlias(wxCommandEvent& event);
void BrowseAndSelectDocFile(wxCommandEvent& event);
void DeleteAllFootprintFilter(wxCommandEvent& event);

View File

@ -1,286 +1,286 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_edit_component_in_lib_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_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* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxVERTICAL );
m_NoteBook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_PanelBasic = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
wxBoxSizer* bSizerBasicPanel;
bSizerBasicPanel = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* m_OptionsBoxSizer;
m_OptionsBoxSizer = new wxStaticBoxSizer( new wxStaticBox( m_PanelBasic, wxID_ANY, _("General :") ), wxVERTICAL );
m_AsConvertButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("As Convert"), wxDefaultPosition, wxDefaultSize, 0 );
m_AsConvertButt->SetToolTip( _("Check this option for components that have a De Morgan representation.\nThis is usual for gates.") );
m_OptionsBoxSizer->Add( m_AsConvertButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ShowPinNumButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Show Pin Num"), wxDefaultPosition, wxDefaultSize, 0 );
m_ShowPinNumButt->SetValue(true);
m_ShowPinNumButt->SetToolTip( _("Show or hide pin numbers") );
m_OptionsBoxSizer->Add( m_ShowPinNumButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ShowPinNameButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Show Pin Name"), wxDefaultPosition, wxDefaultSize, 0 );
m_ShowPinNameButt->SetValue(true);
m_ShowPinNameButt->SetToolTip( _("Show or hide pin names") );
m_OptionsBoxSizer->Add( m_ShowPinNameButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PinsNameInsideButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Pin Name Inside"), wxDefaultPosition, wxDefaultSize, 0 );
m_PinsNameInsideButt->SetValue(true);
m_PinsNameInsideButt->SetToolTip( _("Check this option to have pin names inside the body and pin number outside.\nIf not checked pins names and pins numbers are outside.") );
m_OptionsBoxSizer->Add( m_PinsNameInsideButt, 0, wxALL, 5 );
bSizerBasicPanel->Add( m_OptionsBoxSizer, 0, 0, 5 );
m_staticline3 = new wxStaticLine( m_PanelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerBasicPanel->Add( m_staticline3, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizerMidBasicPanel;
bSizerMidBasicPanel = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizernbunits;
bSizernbunits = new wxBoxSizer( wxVERTICAL );
m_staticTextNbUnits = new wxStaticText( m_PanelBasic, wxID_ANY, _("Number of Units:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextNbUnits->Wrap( -1 );
m_staticTextNbUnits->SetToolTip( _("This is the number of parts in this component package.\nA 74LS00 gate has 4 parts per packages.") );
bSizernbunits->Add( m_staticTextNbUnits, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_SelNumberOfUnits = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 26, 1 );
bSizernbunits->Add( m_SelNumberOfUnits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizerMidBasicPanel->Add( bSizernbunits, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer17;
bSizer17 = new wxBoxSizer( wxVERTICAL );
m_staticTextskew = new wxStaticText( m_PanelBasic, wxID_ANY, _("Skew:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextskew->Wrap( -1 );
m_staticTextskew->SetToolTip( _("Margin (in 0.001 inches) between a pin name position and the component body.\nA value from 10 to 40 is usually good.") );
bSizer17->Add( m_staticTextskew, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_SetSkew = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 );
bSizer17->Add( m_SetSkew, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerMidBasicPanel->Add( bSizer17, 1, wxEXPAND, 5 );
bSizerBasicPanel->Add( bSizerMidBasicPanel, 0, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( m_PanelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerBasicPanel->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_OptionPower = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Power Symbol"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptionPower->SetToolTip( _("Check this option for power symbols.\nPower symbols have specific properties for Eeschema:\n- Value cannot be edited (to avoid mistakes) because this is the pin name that is important for a power symbol\n- Reference is updated automatically when a netlist is created (no need to run Annotate)") );
bSizerBasicPanel->Add( m_OptionPower, 0, wxALL, 5 );
m_OptionPartsLocked = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Parts are locked"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptionPartsLocked->SetToolTip( _("Check this option if Eeschema cannot change parts selections inside a given package\nThis happens when parts are different in this package.\nWhen this option is not checked, Eeschema automatically choose the parts in packages to minimize packages count") );
bSizerBasicPanel->Add( m_OptionPartsLocked, 0, wxALL, 5 );
m_PanelBasic->SetSizer( bSizerBasicPanel );
m_PanelBasic->Layout();
bSizerBasicPanel->Fit( m_PanelBasic );
m_NoteBook->AddPage( m_PanelBasic, _("Options"), true );
m_PanelDoc = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
wxBoxSizer* m_PanelDocBoxSizer;
m_PanelDocBoxSizer = new wxBoxSizer( wxVERTICAL );
m_staticTextDescription = new wxStaticText( m_PanelDoc, wxID_ANY, _("Description:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDescription->Wrap( -1 );
m_staticTextDescription->SetToolTip( _("A short description that is displayed in Eeschema.\nCan be a very good help when selecting components in libraries components lists.") );
m_PanelDocBoxSizer->Add( m_staticTextDescription, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_DocCtrl = new wxTextCtrl( m_PanelDoc, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_PanelDocBoxSizer->Add( m_DocCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticTextKeywords = new wxStaticText( m_PanelDoc, wxID_ANY, _("Keywords:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextKeywords->Wrap( -1 );
m_staticTextKeywords->SetToolTip( _("Enter key words that can be used to select this component.\nKey words cannot have spaces and are separated by a space.") );
m_PanelDocBoxSizer->Add( m_staticTextKeywords, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_KeywordsCtrl = new wxTextCtrl( m_PanelDoc, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_PanelDocBoxSizer->Add( m_KeywordsCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticTextDocFileName = new wxStaticText( m_PanelDoc, wxID_ANY, _("DocFileName:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDocFileName->Wrap( -1 );
m_staticTextDocFileName->SetToolTip( _("Enter the documentation file (a .pdf document) associated to the component.") );
m_PanelDocBoxSizer->Add( m_staticTextDocFileName, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_DocfileCtrl = new wxTextCtrl( m_PanelDoc, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 400,-1 ), 0 );
m_PanelDocBoxSizer->Add( m_DocfileCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerPaneldocbutts;
bSizerPaneldocbutts = new wxBoxSizer( wxHORIZONTAL );
m_ButtonCopyDoc = new wxButton( m_PanelDoc, ID_COPY_DOC_TO_ALIAS, _("Copy Doc"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPaneldocbutts->Add( m_ButtonCopyDoc, 0, wxALL, 5 );
m_buttonBrowseDocFiles = new wxButton( m_PanelDoc, ID_BROWSE_DOC_FILES, _("Browse DocFiles"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPaneldocbutts->Add( m_buttonBrowseDocFiles, 0, wxALL, 5 );
m_PanelDocBoxSizer->Add( bSizerPaneldocbutts, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
m_PanelDoc->SetSizer( m_PanelDocBoxSizer );
m_PanelDoc->Layout();
m_PanelDocBoxSizer->Fit( m_PanelDoc );
m_NoteBook->AddPage( m_PanelDoc, _("Description"), false );
m_PanelAlias = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
wxBoxSizer* bSizerMainPanelAlias;
bSizerMainPanelAlias = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bLeftBoxSizerPanelAlias;
bLeftBoxSizerPanelAlias = new wxBoxSizer( wxVERTICAL );
m_staticTextAlias = new wxStaticText( m_PanelAlias, wxID_ANY, _("Alias List:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextAlias->Wrap( -1 );
m_staticTextAlias->SetToolTip( _("An alias is a component that uses the body of its root component.\nIt has its own documentation and keywords.\nA fast way to extend a library with similar components") );
bLeftBoxSizerPanelAlias->Add( m_staticTextAlias, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PartAliasListCtrl = new wxListBox( m_PanelAlias, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
bLeftBoxSizerPanelAlias->Add( m_PartAliasListCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerMainPanelAlias->Add( bLeftBoxSizerPanelAlias, 1, wxEXPAND, 5 );
wxBoxSizer* bRightBoxSizerPanelAlias;
bRightBoxSizerPanelAlias = new wxBoxSizer( wxVERTICAL );
m_ButtonAddeAlias = new wxButton( m_PanelAlias, ID_ADD_ALIAS, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bRightBoxSizerPanelAlias->Add( m_ButtonAddeAlias, 0, wxALL|wxEXPAND, 5 );
m_ButtonDeleteOneAlias = new wxButton( m_PanelAlias, ID_DELETE_ONE_ALIAS, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
bRightBoxSizerPanelAlias->Add( m_ButtonDeleteOneAlias, 0, wxALL|wxEXPAND, 5 );
m_ButtonDeleteAllAlias = new wxButton( m_PanelAlias, ID_DELETE_ALL_ALIAS, _("Delete All"), wxDefaultPosition, wxDefaultSize, 0 );
bRightBoxSizerPanelAlias->Add( m_ButtonDeleteAllAlias, 0, wxALL, 5 );
bSizerMainPanelAlias->Add( bRightBoxSizerPanelAlias, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_PanelAlias->SetSizer( bSizerMainPanelAlias );
m_PanelAlias->Layout();
bSizerMainPanelAlias->Fit( m_PanelAlias );
m_NoteBook->AddPage( m_PanelAlias, _("Alias"), false );
m_PanelFootprintFilter = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
wxBoxSizer* bPanelFpFilterBoxSizer;
bPanelFpFilterBoxSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bFpFilterLeftBoxSizer;
bFpFilterLeftBoxSizer = new wxBoxSizer( wxVERTICAL );
m_staticTextFootprints = new wxStaticText( m_PanelFootprintFilter, wxID_ANY, _("Footprints"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextFootprints->Wrap( -1 );
m_staticTextFootprints->SetToolTip( _("A list of footprints names that can be used for this component.\nFootprints names can used jockers.\n(like sm* to allow all footprints names starting by sm).") );
bFpFilterLeftBoxSizer->Add( m_staticTextFootprints, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_FootprintFilterListBox = new wxListBox( m_PanelFootprintFilter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
bFpFilterLeftBoxSizer->Add( m_FootprintFilterListBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bPanelFpFilterBoxSizer->Add( bFpFilterLeftBoxSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bFpFilterRightBoxSizer;
bFpFilterRightBoxSizer = new wxBoxSizer( wxVERTICAL );
m_buttonAddFpF = new wxButton( m_PanelFootprintFilter, ID_ADD_FOOTPRINT_FILTER, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bFpFilterRightBoxSizer->Add( m_buttonAddFpF, 0, wxALL|wxEXPAND, 5 );
m_ButtonDeleteOneFootprintFilter = new wxButton( m_PanelFootprintFilter, ID_DELETE_ONE_FOOTPRINT_FILTER, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
bFpFilterRightBoxSizer->Add( m_ButtonDeleteOneFootprintFilter, 0, wxALL|wxEXPAND, 5 );
m_ButtonDeleteAllFootprintFilter = new wxButton( m_PanelFootprintFilter, ID_DELETE_ALL_FOOTPRINT_FILTER, _("Delete All"), wxDefaultPosition, wxDefaultSize, 0 );
bFpFilterRightBoxSizer->Add( m_ButtonDeleteAllFootprintFilter, 0, wxALL|wxEXPAND, 5 );
bPanelFpFilterBoxSizer->Add( bFpFilterRightBoxSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_PanelFootprintFilter->SetSizer( bPanelFpFilterBoxSizer );
m_PanelFootprintFilter->Layout();
bPanelFpFilterBoxSizer->Fit( m_PanelFootprintFilter );
m_NoteBook->AddPage( m_PanelFootprintFilter, _("Footprint Filter"), false );
bUpperSizer->Add( m_NoteBook, 1, wxEXPAND, 5 );
bMainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 );
m_stdSizerButton = new wxStdDialogButtonSizer();
m_stdSizerButtonOK = new wxButton( this, wxID_OK );
m_stdSizerButton->AddButton( m_stdSizerButtonOK );
m_stdSizerButtonCancel = new wxButton( this, wxID_CANCEL );
m_stdSizerButton->AddButton( m_stdSizerButtonCancel );
m_stdSizerButton->Realize();
bMainSizer->Add( m_stdSizerButton, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
m_ButtonCopyDoc->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::CopyDocToAlias ), NULL, this );
m_buttonBrowseDocFiles->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::BrowseAndSelectDocFile ), NULL, this );
m_ButtonAddeAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddAliasOfPart ), NULL, this );
m_ButtonDeleteOneAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAliasOfPart ), NULL, this );
m_ButtonDeleteAllAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllAliasOfPart ), NULL, this );
m_buttonAddFpF->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddFootprintFilter ), NULL, this );
m_ButtonDeleteOneFootprintFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteOneFootprintFilter ), NULL, this );
m_ButtonDeleteAllFootprintFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllFootprintFilter ), NULL, this );
m_stdSizerButtonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnCancelClick ), NULL, this );
m_stdSizerButtonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnOkClick ), NULL, this );
}
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::~DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE()
{
// Disconnect Events
m_ButtonCopyDoc->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::CopyDocToAlias ), NULL, this );
m_buttonBrowseDocFiles->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::BrowseAndSelectDocFile ), NULL, this );
m_ButtonAddeAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddAliasOfPart ), NULL, this );
m_ButtonDeleteOneAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAliasOfPart ), NULL, this );
m_ButtonDeleteAllAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllAliasOfPart ), NULL, this );
m_buttonAddFpF->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddFootprintFilter ), NULL, this );
m_ButtonDeleteOneFootprintFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteOneFootprintFilter ), NULL, this );
m_ButtonDeleteAllFootprintFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllFootprintFilter ), NULL, this );
m_stdSizerButtonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnCancelClick ), NULL, this );
m_stdSizerButtonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnOkClick ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_edit_component_in_lib_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_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* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxVERTICAL );
m_NoteBook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_PanelBasic = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
wxBoxSizer* bSizerBasicPanel;
bSizerBasicPanel = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* m_OptionsBoxSizer;
m_OptionsBoxSizer = new wxStaticBoxSizer( new wxStaticBox( m_PanelBasic, wxID_ANY, _("General :") ), wxVERTICAL );
m_AsConvertButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("As Convert"), wxDefaultPosition, wxDefaultSize, 0 );
m_AsConvertButt->SetToolTip( _("Check this option for components that have a De Morgan representation.\nThis is usual for gates.") );
m_OptionsBoxSizer->Add( m_AsConvertButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ShowPinNumButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Show Pin Num"), wxDefaultPosition, wxDefaultSize, 0 );
m_ShowPinNumButt->SetValue(true);
m_ShowPinNumButt->SetToolTip( _("Show or hide pin numbers") );
m_OptionsBoxSizer->Add( m_ShowPinNumButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ShowPinNameButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Show Pin Name"), wxDefaultPosition, wxDefaultSize, 0 );
m_ShowPinNameButt->SetValue(true);
m_ShowPinNameButt->SetToolTip( _("Show or hide pin names") );
m_OptionsBoxSizer->Add( m_ShowPinNameButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PinsNameInsideButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Pin Name Inside"), wxDefaultPosition, wxDefaultSize, 0 );
m_PinsNameInsideButt->SetValue(true);
m_PinsNameInsideButt->SetToolTip( _("Check this option to have pin names inside the body and pin number outside.\nIf not checked pins names and pins numbers are outside.") );
m_OptionsBoxSizer->Add( m_PinsNameInsideButt, 0, wxALL, 5 );
bSizerBasicPanel->Add( m_OptionsBoxSizer, 0, 0, 5 );
m_staticline3 = new wxStaticLine( m_PanelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerBasicPanel->Add( m_staticline3, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizerMidBasicPanel;
bSizerMidBasicPanel = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizernbunits;
bSizernbunits = new wxBoxSizer( wxVERTICAL );
m_staticTextNbUnits = new wxStaticText( m_PanelBasic, wxID_ANY, _("Number of Units:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextNbUnits->Wrap( -1 );
m_staticTextNbUnits->SetToolTip( _("This is the number of parts in this component package.\nA 74LS00 gate has 4 parts per packages.") );
bSizernbunits->Add( m_staticTextNbUnits, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_SelNumberOfUnits = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 26, 1 );
bSizernbunits->Add( m_SelNumberOfUnits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizerMidBasicPanel->Add( bSizernbunits, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer17;
bSizer17 = new wxBoxSizer( wxVERTICAL );
m_staticTextskew = new wxStaticText( m_PanelBasic, wxID_ANY, _("Skew:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextskew->Wrap( -1 );
m_staticTextskew->SetToolTip( _("Margin (in 0.001 inches) between a pin name position and the component body.\nA value from 10 to 40 is usually good.") );
bSizer17->Add( m_staticTextskew, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_SetSkew = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 );
bSizer17->Add( m_SetSkew, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerMidBasicPanel->Add( bSizer17, 1, wxEXPAND, 5 );
bSizerBasicPanel->Add( bSizerMidBasicPanel, 0, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( m_PanelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerBasicPanel->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_OptionPower = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Power Symbol"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptionPower->SetToolTip( _("Check this option for power symbols.\nPower symbols have specific properties for Eeschema:\n- Value cannot be edited (to avoid mistakes) because this is the pin name that is important for a power symbol\n- Reference is updated automatically when a netlist is created (no need to run Annotate)") );
bSizerBasicPanel->Add( m_OptionPower, 0, wxALL, 5 );
m_OptionPartsLocked = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Parts are locked"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptionPartsLocked->SetToolTip( _("Check this option if Eeschema cannot change parts selections inside a given package\nThis happens when parts are different in this package.\nWhen this option is not checked, Eeschema automatically choose the parts in packages to minimize packages count") );
bSizerBasicPanel->Add( m_OptionPartsLocked, 0, wxALL, 5 );
m_PanelBasic->SetSizer( bSizerBasicPanel );
m_PanelBasic->Layout();
bSizerBasicPanel->Fit( m_PanelBasic );
m_NoteBook->AddPage( m_PanelBasic, _("Options"), false );
m_PanelDoc = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
wxBoxSizer* m_PanelDocBoxSizer;
m_PanelDocBoxSizer = new wxBoxSizer( wxVERTICAL );
m_staticTextDescription = new wxStaticText( m_PanelDoc, wxID_ANY, _("Description:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDescription->Wrap( -1 );
m_staticTextDescription->SetToolTip( _("A short description that is displayed in Eeschema.\nCan be a very good help when selecting components in libraries components lists.") );
m_PanelDocBoxSizer->Add( m_staticTextDescription, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_DocCtrl = new wxTextCtrl( m_PanelDoc, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_PanelDocBoxSizer->Add( m_DocCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticTextKeywords = new wxStaticText( m_PanelDoc, wxID_ANY, _("Keywords:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextKeywords->Wrap( -1 );
m_staticTextKeywords->SetToolTip( _("Enter key words that can be used to select this component.\nKey words cannot have spaces and are separated by a space.") );
m_PanelDocBoxSizer->Add( m_staticTextKeywords, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_KeywordsCtrl = new wxTextCtrl( m_PanelDoc, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_PanelDocBoxSizer->Add( m_KeywordsCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticTextDocFileName = new wxStaticText( m_PanelDoc, wxID_ANY, _("DocFileName:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDocFileName->Wrap( -1 );
m_staticTextDocFileName->SetToolTip( _("Enter the documentation file (a .pdf document) associated to the component.") );
m_PanelDocBoxSizer->Add( m_staticTextDocFileName, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_DocfileCtrl = new wxTextCtrl( m_PanelDoc, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 400,-1 ), 0 );
m_PanelDocBoxSizer->Add( m_DocfileCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerPaneldocbutts;
bSizerPaneldocbutts = new wxBoxSizer( wxHORIZONTAL );
m_ButtonCopyDoc = new wxButton( m_PanelDoc, ID_COPY_DOC_TO_ALIAS, _("Copy Doc from Parent"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPaneldocbutts->Add( m_ButtonCopyDoc, 0, wxALL, 5 );
m_buttonBrowseDocFiles = new wxButton( m_PanelDoc, ID_BROWSE_DOC_FILES, _("Browse DocFiles"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPaneldocbutts->Add( m_buttonBrowseDocFiles, 0, wxALL, 5 );
m_PanelDocBoxSizer->Add( bSizerPaneldocbutts, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
m_PanelDoc->SetSizer( m_PanelDocBoxSizer );
m_PanelDoc->Layout();
m_PanelDocBoxSizer->Fit( m_PanelDoc );
m_NoteBook->AddPage( m_PanelDoc, _("Description"), true );
m_PanelAlias = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
wxBoxSizer* bSizerMainPanelAlias;
bSizerMainPanelAlias = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bLeftBoxSizerPanelAlias;
bLeftBoxSizerPanelAlias = new wxBoxSizer( wxVERTICAL );
m_staticTextAlias = new wxStaticText( m_PanelAlias, wxID_ANY, _("Alias List:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextAlias->Wrap( -1 );
m_staticTextAlias->SetToolTip( _("An alias is a component that uses the body of its root component.\nIt has its own documentation and keywords.\nA fast way to extend a library with similar components") );
bLeftBoxSizerPanelAlias->Add( m_staticTextAlias, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PartAliasListCtrl = new wxListBox( m_PanelAlias, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
bLeftBoxSizerPanelAlias->Add( m_PartAliasListCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerMainPanelAlias->Add( bLeftBoxSizerPanelAlias, 1, wxEXPAND, 5 );
wxBoxSizer* bRightBoxSizerPanelAlias;
bRightBoxSizerPanelAlias = new wxBoxSizer( wxVERTICAL );
m_ButtonAddeAlias = new wxButton( m_PanelAlias, ID_ADD_ALIAS, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bRightBoxSizerPanelAlias->Add( m_ButtonAddeAlias, 0, wxALL|wxEXPAND, 5 );
m_ButtonDeleteOneAlias = new wxButton( m_PanelAlias, ID_DELETE_ONE_ALIAS, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
bRightBoxSizerPanelAlias->Add( m_ButtonDeleteOneAlias, 0, wxALL|wxEXPAND, 5 );
m_ButtonDeleteAllAlias = new wxButton( m_PanelAlias, ID_DELETE_ALL_ALIAS, _("Delete All"), wxDefaultPosition, wxDefaultSize, 0 );
bRightBoxSizerPanelAlias->Add( m_ButtonDeleteAllAlias, 0, wxALL, 5 );
bSizerMainPanelAlias->Add( bRightBoxSizerPanelAlias, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_PanelAlias->SetSizer( bSizerMainPanelAlias );
m_PanelAlias->Layout();
bSizerMainPanelAlias->Fit( m_PanelAlias );
m_NoteBook->AddPage( m_PanelAlias, _("Alias"), false );
m_PanelFootprintFilter = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
wxBoxSizer* bPanelFpFilterBoxSizer;
bPanelFpFilterBoxSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bFpFilterLeftBoxSizer;
bFpFilterLeftBoxSizer = new wxBoxSizer( wxVERTICAL );
m_staticTextFootprints = new wxStaticText( m_PanelFootprintFilter, wxID_ANY, _("Footprints"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextFootprints->Wrap( -1 );
m_staticTextFootprints->SetToolTip( _("A list of footprints names that can be used for this component.\nFootprints names can used jockers.\n(like sm* to allow all footprints names starting by sm).") );
bFpFilterLeftBoxSizer->Add( m_staticTextFootprints, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_FootprintFilterListBox = new wxListBox( m_PanelFootprintFilter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
bFpFilterLeftBoxSizer->Add( m_FootprintFilterListBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bPanelFpFilterBoxSizer->Add( bFpFilterLeftBoxSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bFpFilterRightBoxSizer;
bFpFilterRightBoxSizer = new wxBoxSizer( wxVERTICAL );
m_buttonAddFpF = new wxButton( m_PanelFootprintFilter, ID_ADD_FOOTPRINT_FILTER, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bFpFilterRightBoxSizer->Add( m_buttonAddFpF, 0, wxALL|wxEXPAND, 5 );
m_ButtonDeleteOneFootprintFilter = new wxButton( m_PanelFootprintFilter, ID_DELETE_ONE_FOOTPRINT_FILTER, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
bFpFilterRightBoxSizer->Add( m_ButtonDeleteOneFootprintFilter, 0, wxALL|wxEXPAND, 5 );
m_ButtonDeleteAllFootprintFilter = new wxButton( m_PanelFootprintFilter, ID_DELETE_ALL_FOOTPRINT_FILTER, _("Delete All"), wxDefaultPosition, wxDefaultSize, 0 );
bFpFilterRightBoxSizer->Add( m_ButtonDeleteAllFootprintFilter, 0, wxALL|wxEXPAND, 5 );
bPanelFpFilterBoxSizer->Add( bFpFilterRightBoxSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_PanelFootprintFilter->SetSizer( bPanelFpFilterBoxSizer );
m_PanelFootprintFilter->Layout();
bPanelFpFilterBoxSizer->Fit( m_PanelFootprintFilter );
m_NoteBook->AddPage( m_PanelFootprintFilter, _("Footprint Filter"), false );
bUpperSizer->Add( m_NoteBook, 1, wxEXPAND, 5 );
bMainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 );
m_stdSizerButton = new wxStdDialogButtonSizer();
m_stdSizerButtonOK = new wxButton( this, wxID_OK );
m_stdSizerButton->AddButton( m_stdSizerButtonOK );
m_stdSizerButtonCancel = new wxButton( this, wxID_CANCEL );
m_stdSizerButton->AddButton( m_stdSizerButtonCancel );
m_stdSizerButton->Realize();
bMainSizer->Add( m_stdSizerButton, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
m_ButtonCopyDoc->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::CopyDocFromRootToAlias ), NULL, this );
m_buttonBrowseDocFiles->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::BrowseAndSelectDocFile ), NULL, this );
m_ButtonAddeAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddAliasOfPart ), NULL, this );
m_ButtonDeleteOneAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAliasOfPart ), NULL, this );
m_ButtonDeleteAllAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllAliasOfPart ), NULL, this );
m_buttonAddFpF->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddFootprintFilter ), NULL, this );
m_ButtonDeleteOneFootprintFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteOneFootprintFilter ), NULL, this );
m_ButtonDeleteAllFootprintFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllFootprintFilter ), NULL, this );
m_stdSizerButtonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnCancelClick ), NULL, this );
m_stdSizerButtonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnOkClick ), NULL, this );
}
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::~DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE()
{
// Disconnect Events
m_ButtonCopyDoc->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::CopyDocFromRootToAlias ), NULL, this );
m_buttonBrowseDocFiles->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::BrowseAndSelectDocFile ), NULL, this );
m_ButtonAddeAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddAliasOfPart ), NULL, this );
m_ButtonDeleteOneAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAliasOfPart ), NULL, this );
m_ButtonDeleteAllAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllAliasOfPart ), NULL, this );
m_buttonAddFpF->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddFootprintFilter ), NULL, this );
m_ButtonDeleteOneFootprintFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteOneFootprintFilter ), NULL, this );
m_ButtonDeleteAllFootprintFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllFootprintFilter ), NULL, this );
m_stdSizerButtonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnCancelClick ), NULL, this );
m_stdSizerButtonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnOkClick ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,115 +1,115 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EDIT_COMPONENT_IN_LIB_BASE_H__
#define __DIALOG_EDIT_COMPONENT_IN_LIB_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/checkbox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/statline.h>
#include <wx/stattext.h>
#include <wx/spinctrl.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/listbox.h>
#include <wx/notebook.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_LIBEDIT_NOTEBOOK 1000
#define ID_COPY_DOC_TO_ALIAS 1001
#define ID_BROWSE_DOC_FILES 1002
#define ID_ADD_ALIAS 1003
#define ID_DELETE_ONE_ALIAS 1004
#define ID_DELETE_ALL_ALIAS 1005
#define ID_ADD_FOOTPRINT_FILTER 1006
#define ID_DELETE_ONE_FOOTPRINT_FILTER 1007
#define ID_DELETE_ALL_FOOTPRINT_FILTER 1008
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public DIALOG_SHIM
{
private:
protected:
wxNotebook* m_NoteBook;
wxPanel* m_PanelBasic;
wxCheckBox* m_AsConvertButt;
wxCheckBox* m_ShowPinNumButt;
wxCheckBox* m_ShowPinNameButt;
wxCheckBox* m_PinsNameInsideButt;
wxStaticLine* m_staticline3;
wxStaticText* m_staticTextNbUnits;
wxSpinCtrl* m_SelNumberOfUnits;
wxStaticText* m_staticTextskew;
wxSpinCtrl* m_SetSkew;
wxStaticLine* m_staticline1;
wxCheckBox* m_OptionPower;
wxCheckBox* m_OptionPartsLocked;
wxPanel* m_PanelDoc;
wxStaticText* m_staticTextDescription;
wxTextCtrl* m_DocCtrl;
wxStaticText* m_staticTextKeywords;
wxTextCtrl* m_KeywordsCtrl;
wxStaticText* m_staticTextDocFileName;
wxTextCtrl* m_DocfileCtrl;
wxButton* m_ButtonCopyDoc;
wxButton* m_buttonBrowseDocFiles;
wxPanel* m_PanelAlias;
wxStaticText* m_staticTextAlias;
wxListBox* m_PartAliasListCtrl;
wxButton* m_ButtonAddeAlias;
wxButton* m_ButtonDeleteOneAlias;
wxButton* m_ButtonDeleteAllAlias;
wxPanel* m_PanelFootprintFilter;
wxStaticText* m_staticTextFootprints;
wxListBox* m_FootprintFilterListBox;
wxButton* m_buttonAddFpF;
wxButton* m_ButtonDeleteOneFootprintFilter;
wxButton* m_ButtonDeleteAllFootprintFilter;
wxStdDialogButtonSizer* m_stdSizerButton;
wxButton* m_stdSizerButtonOK;
wxButton* m_stdSizerButtonCancel;
// Virtual event handlers, overide them in your derived class
virtual void CopyDocToAlias( wxCommandEvent& event ) { event.Skip(); }
virtual void BrowseAndSelectDocFile( wxCommandEvent& event ) { event.Skip(); }
virtual void AddAliasOfPart( wxCommandEvent& event ) { event.Skip(); }
virtual void DeleteAliasOfPart( wxCommandEvent& event ) { event.Skip(); }
virtual void DeleteAllAliasOfPart( wxCommandEvent& event ) { event.Skip(); }
virtual void AddFootprintFilter( wxCommandEvent& event ) { event.Skip(); }
virtual void DeleteOneFootprintFilter( wxCommandEvent& event ) { event.Skip(); }
virtual void DeleteAllFootprintFilter( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wxWindow* parent, wxWindowID id = ID_LIBEDIT_NOTEBOOK, const wxString& title = _("Lib Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE();
};
#endif //__DIALOG_EDIT_COMPONENT_IN_LIB_BASE_H__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EDIT_COMPONENT_IN_LIB_BASE_H__
#define __DIALOG_EDIT_COMPONENT_IN_LIB_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/checkbox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/statline.h>
#include <wx/stattext.h>
#include <wx/spinctrl.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/listbox.h>
#include <wx/notebook.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_LIBEDIT_NOTEBOOK 1000
#define ID_COPY_DOC_TO_ALIAS 1001
#define ID_BROWSE_DOC_FILES 1002
#define ID_ADD_ALIAS 1003
#define ID_DELETE_ONE_ALIAS 1004
#define ID_DELETE_ALL_ALIAS 1005
#define ID_ADD_FOOTPRINT_FILTER 1006
#define ID_DELETE_ONE_FOOTPRINT_FILTER 1007
#define ID_DELETE_ALL_FOOTPRINT_FILTER 1008
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public DIALOG_SHIM
{
private:
protected:
wxNotebook* m_NoteBook;
wxPanel* m_PanelBasic;
wxCheckBox* m_AsConvertButt;
wxCheckBox* m_ShowPinNumButt;
wxCheckBox* m_ShowPinNameButt;
wxCheckBox* m_PinsNameInsideButt;
wxStaticLine* m_staticline3;
wxStaticText* m_staticTextNbUnits;
wxSpinCtrl* m_SelNumberOfUnits;
wxStaticText* m_staticTextskew;
wxSpinCtrl* m_SetSkew;
wxStaticLine* m_staticline1;
wxCheckBox* m_OptionPower;
wxCheckBox* m_OptionPartsLocked;
wxPanel* m_PanelDoc;
wxStaticText* m_staticTextDescription;
wxTextCtrl* m_DocCtrl;
wxStaticText* m_staticTextKeywords;
wxTextCtrl* m_KeywordsCtrl;
wxStaticText* m_staticTextDocFileName;
wxTextCtrl* m_DocfileCtrl;
wxButton* m_ButtonCopyDoc;
wxButton* m_buttonBrowseDocFiles;
wxPanel* m_PanelAlias;
wxStaticText* m_staticTextAlias;
wxListBox* m_PartAliasListCtrl;
wxButton* m_ButtonAddeAlias;
wxButton* m_ButtonDeleteOneAlias;
wxButton* m_ButtonDeleteAllAlias;
wxPanel* m_PanelFootprintFilter;
wxStaticText* m_staticTextFootprints;
wxListBox* m_FootprintFilterListBox;
wxButton* m_buttonAddFpF;
wxButton* m_ButtonDeleteOneFootprintFilter;
wxButton* m_ButtonDeleteAllFootprintFilter;
wxStdDialogButtonSizer* m_stdSizerButton;
wxButton* m_stdSizerButtonOK;
wxButton* m_stdSizerButtonCancel;
// Virtual event handlers, overide them in your derived class
virtual void CopyDocFromRootToAlias( wxCommandEvent& event ) { event.Skip(); }
virtual void BrowseAndSelectDocFile( wxCommandEvent& event ) { event.Skip(); }
virtual void AddAliasOfPart( wxCommandEvent& event ) { event.Skip(); }
virtual void DeleteAliasOfPart( wxCommandEvent& event ) { event.Skip(); }
virtual void DeleteAllAliasOfPart( wxCommandEvent& event ) { event.Skip(); }
virtual void AddFootprintFilter( wxCommandEvent& event ) { event.Skip(); }
virtual void DeleteOneFootprintFilter( wxCommandEvent& event ) { event.Skip(); }
virtual void DeleteAllFootprintFilter( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wxWindow* parent, wxWindowID id = ID_LIBEDIT_NOTEBOOK, const wxString& title = _("Lib Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE();
};
#endif //__DIALOG_EDIT_COMPONENT_IN_LIB_BASE_H__

File diff suppressed because it is too large Load Diff

View File

@ -41,44 +41,35 @@ public:
void SetUnits( const wxArrayString& units, int select = 0 );
int GetUnitsSelection( void ) { return m_choiceUnits->GetSelection(); }
void SetGridSelection( int select )
{
m_choiceGridSize->SetSelection( select );
}
void SetGridSelection( int select ) { m_choiceGridSize->SetSelection( select ); }
int GetGridSelection( void ) { return m_choiceGridSize->GetSelection(); }
void SetGridSizes( const GRIDS& grid_sizes, int grid_id );
void SetLineWidth( int line_width )
void SetBusWidth( int aWidth )
{
m_spinLineWidth->SetValue( line_width );
m_spinBusWidth->SetValue( aWidth );
}
int GetBusWidth( void )
{
return m_spinBusWidth->GetValue();
}
void SetLineWidth( int aWidth ) { m_spinLineWidth->SetValue( aWidth ); }
int GetLineWidth( void ) { return m_spinLineWidth->GetValue(); }
void SetTextSize( int text_size )
{
m_spinTextSize->SetValue( text_size );
}
void SetTextSize( int text_size ) { m_spinTextSize->SetValue( text_size ); }
int GetTextSize( void ) { return m_spinTextSize->GetValue(); }
void SetRepeatHorizontal( int displacement )
{
m_spinRepeatHorizontal->SetValue( displacement );
}
int GetRepeatHorizontal( void )
{
return m_spinRepeatHorizontal->GetValue();
}
int GetRepeatHorizontal( void ) { return m_spinRepeatHorizontal->GetValue(); }
void SetRepeatVertical( int displacement ) { m_spinRepeatVertical->SetValue( displacement ); }
void SetRepeatVertical( int displacement )
{
m_spinRepeatVertical->SetValue( displacement );
}
int GetRepeatVertical( void ) { return m_spinRepeatVertical->GetValue(); }
void SetRepeatLabel( int increment )
{
m_spinRepeatLabel->SetValue( increment );
}
void SetRepeatLabel( int increment ) { m_spinRepeatLabel->SetValue( increment ); }
int GetRepeatLabel( void ) { return m_spinRepeatLabel->GetValue(); }
void SetAutoSaveInterval( int aInterval ) { m_spinAutoSaveInterval->SetValue( aInterval ); }
@ -87,14 +78,8 @@ public:
void SetShowGrid( bool show ) { m_checkShowGrid->SetValue( show ); }
bool GetShowGrid( void ) { return m_checkShowGrid->GetValue(); }
void SetShowHiddenPins( bool show )
{
m_checkShowHiddenPins->SetValue( show );
}
bool GetShowHiddenPins( void )
{
return m_checkShowHiddenPins->GetValue();
}
void SetShowHiddenPins( bool show ) { m_checkShowHiddenPins->SetValue( show ); }
bool GetShowHiddenPins( void ) { return m_checkShowHiddenPins->GetValue(); }
void SetEnableMiddleButtonPan( bool enable )
{
@ -106,7 +91,6 @@ public:
{
return m_checkEnableMiddleButtonPan->GetValue();
}
void SetMiddleButtonPanLimited( bool enable )
{
m_checkMiddleButtonPanLimited->SetValue( enable );
@ -116,30 +100,14 @@ public:
return m_checkMiddleButtonPanLimited->GetValue();
}
void SetEnableAutoPan( bool enable )
{
m_checkAutoPan->SetValue( enable );
}
void SetEnableAutoPan( bool enable ) { m_checkAutoPan->SetValue( enable ); }
bool GetEnableAutoPan( void ) { return m_checkAutoPan->GetValue(); }
void SetEnableHVBusOrientation( bool enable )
{
m_checkHVOrientation->SetValue( enable );
}
bool GetEnableHVBusOrientation( void )
{
return m_checkHVOrientation->GetValue();
}
void SetShowPageLimits( bool show )
{
m_checkPageLimits->SetValue( show );
}
bool GetShowPageLimits( void )
{
return m_checkPageLimits->GetValue();
}
void SetEnableHVBusOrientation( bool enable ) { m_checkHVOrientation->SetValue( enable ); }
bool GetEnableHVBusOrientation( void ) { return m_checkHVOrientation->GetValue(); }
void SetShowPageLimits( bool show ) { m_checkPageLimits->SetValue( show ); }
bool GetShowPageLimits( void ) { return m_checkPageLimits->GetValue(); }
/** Set the field \a aNdx textctrl to \a aName */
void SetFieldName( int aNdx, wxString aName );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 17 2012)
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -67,11 +67,22 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_staticGridUnits->Wrap( -1 );
fgSizer1->Add( m_staticGridUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticText51 = new wxStaticText( m_panel1, wxID_ANY, _("Default &bus width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText51->Wrap( -1 );
fgSizer1->Add( m_staticText51, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_spinBusWidth = new wxSpinCtrl( m_panel1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 1, 100, 1 );
fgSizer1->Add( m_spinBusWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
m_staticBusWidthUnits = new wxStaticText( m_panel1, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticBusWidthUnits->Wrap( -1 );
fgSizer1->Add( m_staticBusWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticText5 = new wxStaticText( m_panel1, wxID_ANY, _("Default &line width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
fgSizer1->Add( m_staticText5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_spinLineWidth = new wxSpinCtrl( m_panel1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 100, 0 );
m_spinLineWidth = new wxSpinCtrl( m_panel1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 1, 100, 1 );
fgSizer1->Add( m_spinLineWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
m_staticLineWidthUnits = new wxStaticText( m_panel1, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
@ -93,7 +104,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_staticText9->Wrap( -1 );
fgSizer1->Add( m_staticText9, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_spinRepeatHorizontal = new wxSpinCtrl( m_panel1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, -500, 500, 0 );
m_spinRepeatHorizontal = new wxSpinCtrl( m_panel1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, -5000, 5000, 0 );
fgSizer1->Add( m_spinRepeatHorizontal, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
m_staticRepeatXUnits = new wxStaticText( m_panel1, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
@ -104,7 +115,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_staticText12->Wrap( -1 );
fgSizer1->Add( m_staticText12, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_spinRepeatVertical = new wxSpinCtrl( m_panel1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, -500, 500, 100 );
m_spinRepeatVertical = new wxSpinCtrl( m_panel1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, -5000, 5000, 100 );
fgSizer1->Add( m_spinRepeatVertical, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
m_staticRepeatYUnits = new wxStaticText( m_panel1, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );

View File

@ -25,62 +25,28 @@
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_managed">0</property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center">wxBOTH</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">DIALOG_EESCHEMA_OPTIONS_BASE</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Schematic Editor Options</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -125,20 +91,20 @@
<property name="name">mainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">12</property>
<property name="flag"></property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bOptionsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">0</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxNotebook" expanded="0">
<object class="wxNotebook" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -188,10 +154,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -220,11 +182,11 @@
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="notebookpage" expanded="0">
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">General Options</property>
<property name="select">1</property>
<object class="wxPanel" expanded="0">
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -272,10 +234,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
@ -302,25 +260,25 @@
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">p1mainSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">12</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer3</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">0</property>
<property name="flag">wxALIGN_CENTER|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="0">
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxHORIZONTAL</property>
<property name="growablecols">0,1,2</property>
@ -386,10 +344,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -571,10 +525,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -746,10 +696,259 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Default &amp;bus width:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText51</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxSpinCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="initial">1</property>
<property name="max">100</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min">1</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_spinBusWidth</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxSP_ARROW_KEYS|wxSP_WRAP</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnSpinCtrl"></event>
<event name="OnSpinCtrlText"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">mils</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticBusWidthUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -833,10 +1032,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -898,12 +1093,12 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="initial">0</property>
<property name="initial">1</property>
<property name="max">100</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min">0</property>
<property name="min">1</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
@ -922,10 +1117,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
@ -1011,10 +1202,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -1098,10 +1285,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -1187,10 +1370,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
@ -1276,10 +1455,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -1363,10 +1538,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -1429,11 +1600,11 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="initial">0</property>
<property name="max">500</property>
<property name="max">5000</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min">-500</property>
<property name="min">-5000</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
@ -1452,10 +1623,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
@ -1541,10 +1708,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -1628,10 +1791,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -1694,11 +1853,11 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="initial">100</property>
<property name="max">500</property>
<property name="max">5000</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min">-500</property>
<property name="min">-5000</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
@ -1717,10 +1876,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
@ -1806,10 +1961,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -1893,10 +2044,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -1982,10 +2129,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">1</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
@ -2081,10 +2224,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -2170,10 +2309,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
@ -2259,10 +2394,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -2988,10 +3119,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">User defined field names for schematic components. </property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
@ -3086,10 +3213,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -3200,10 +3323,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -3378,10 +3497,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -3556,10 +3671,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -3734,10 +3845,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -3912,10 +4019,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -4090,10 +4193,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -4268,10 +4367,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -4446,10 +4541,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 17 2012)
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -59,6 +59,9 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog
wxStaticText* m_staticText3;
wxChoice* m_choiceGridSize;
wxStaticText* m_staticGridUnits;
wxStaticText* m_staticText51;
wxSpinCtrl* m_spinBusWidth;
wxStaticText* m_staticBusWidthUnits;
wxStaticText* m_staticText5;
wxSpinCtrl* m_spinLineWidth;
wxStaticText* m_staticLineWidthUnits;

View File

@ -185,14 +185,12 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
sheetpath = SheetList.GetNext();
}
double scale = 10;
plot_offset.x = 0;
plot_offset.y = 0;
plotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".dxf" );
PlotOneSheetDXF( plotFileName, screen, plot_offset, scale );
PlotOneSheetDXF( plotFileName, screen, plot_offset, 1 );
if( !m_select_PlotAll )
break;
@ -232,24 +230,24 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
const PAGE_INFO& pageInfo = screen->GetPageSettings();
plotter->SetPageSettings( pageInfo );
plotter->set_viewport( plot_offset, scale, 0 );
plotter->set_color_mode( m_plotColorOpt );
plotter->SetViewport( plot_offset, IU_PER_DECIMILS, scale, 0 );
plotter->SetColorMode( m_plotColorOpt );
// Init :
plotter->set_creator( wxT( "Eeschema-DXF" ) );
plotter->set_filename( FileName );
plotter->start_plot( output_file );
plotter->SetCreator( wxT( "Eeschema-DXF" ) );
plotter->SetFilename( FileName );
plotter->StartPlot( output_file );
if( m_plot_Sheet_Ref )
{
plotter->set_color( BLACK );
plotter->SetColor( BLACK );
m_Parent->PlotWorkSheet( plotter, screen );
}
screen->Plot( plotter );
// finish
plotter->end_plot();
plotter->EndPlot();
delete plotter;
m_MsgBox->AppendText( wxT( "Ok\n" ) );

View File

@ -330,7 +330,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll )
// Calculation of conversion scales.
// 10x because Eeschema works in mils, not deci-mils
double plot_scale = 10 * (double) plotPage.GetWidthMils() / curPage.GetWidthMils();
double plot_scale = (double) plotPage.GetWidthMils() / curPage.GetWidthMils();
// Calculate offsets
plotOffset.x = -s_Offset.x;
@ -380,26 +380,26 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
plotter->SetPageSettings( pageInfo );
plotter->set_viewport( offset, plot_scale, 0 );
plotter->set_default_line_width( g_DrawDefaultLineThickness );
plotter->SetViewport( offset, IU_PER_DECIMILS, plot_scale, 0 );
plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness );
// Init :
plotter->set_creator( wxT( "Eeschema-HPGL" ) );
plotter->set_filename( FileName );
plotter->set_pen_speed( g_HPGL_Pen_Descr.m_Pen_Speed );
plotter->set_pen_number( g_HPGL_Pen_Descr.m_Pen_Num );
plotter->set_pen_diameter( g_HPGL_Pen_Descr.m_Pen_Diam );
plotter->set_pen_overlap( g_HPGL_Pen_Descr.m_Pen_Diam / 2 );
plotter->start_plot( output_file );
plotter->SetCreator( wxT( "Eeschema-HPGL" ) );
plotter->SetFilename( FileName );
plotter->SetPenSpeed( g_HPGL_Pen_Descr.m_Pen_Speed );
plotter->SetPenNumber( g_HPGL_Pen_Descr.m_Pen_Num );
plotter->SetPenDiameter( g_HPGL_Pen_Descr.m_Pen_Diam );
plotter->SetPenOverlap( g_HPGL_Pen_Descr.m_Pen_Diam / 2 );
plotter->StartPlot( output_file );
plotter->set_color( BLACK );
plotter->SetColor( BLACK );
if( s_plot_Sheet_Ref )
m_Parent->PlotWorkSheet( plotter, screen );
screen->Plot( plotter );
plotter->end_plot();
plotter->EndPlot();
delete plotter;
m_MsgBox->AppendText( wxT( "Ok\n" ) );

View File

@ -0,0 +1,309 @@
/** @file dialog_plot_schematic_PDF.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2010 Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 1992-2010 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 <confirm.h>
#include <worksheet.h>
#include <plot_common.h>
#include <class_sch_screen.h>
#include <wxEeschemaStruct.h>
#include <base_units.h>
#include <general.h>
#include <protos.h>
#include <sch_sheet_path.h>
enum PageFormatReq {
PAGE_SIZE_AUTO,
PAGE_SIZE_A4,
PAGE_SIZE_A
};
#include <dialog_plot_schematic_PDF_base.h>
class DIALOG_PLOT_SCHEMATIC_PDF : public DIALOG_PLOT_SCHEMATIC_PDF_BASE
{
private:
SCH_EDIT_FRAME* m_Parent;
public:
/// Constructors
DIALOG_PLOT_SCHEMATIC_PDF( SCH_EDIT_FRAME* parent );
private:
static bool m_plotColorOpt;
static int m_pageSizeSelect;
static bool m_plot_Sheet_Ref;
bool m_select_PlotAll;
private:
void OnPlotCurrent( wxCommandEvent& event );
void OnPlotAll( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void initDlg();
void initOptVars();
void createPDFFile();
void plotOneSheet( PDF_PLOTTER *plotter, SCH_SCREEN* screen );
void plotSetupPage( PDF_PLOTTER *plotter, SCH_SCREEN* screen );
};
// static members (static to remember last state):
bool DIALOG_PLOT_SCHEMATIC_PDF::m_plotColorOpt = false;
int DIALOG_PLOT_SCHEMATIC_PDF::m_pageSizeSelect = PAGE_SIZE_AUTO;
bool DIALOG_PLOT_SCHEMATIC_PDF::m_plot_Sheet_Ref = true;
void SCH_EDIT_FRAME::ToPlot_PDF( wxCommandEvent& event )
{
DIALOG_PLOT_SCHEMATIC_PDF dlg( this );
dlg.ShowModal();
}
DIALOG_PLOT_SCHEMATIC_PDF::DIALOG_PLOT_SCHEMATIC_PDF( SCH_EDIT_FRAME* parent ) :
DIALOG_PLOT_SCHEMATIC_PDF_BASE( parent )
{
m_Parent = parent;
m_select_PlotAll = false;
initDlg();
GetSizer()->SetSizeHints( this );
Centre();
m_buttonPlotAll->SetDefault();
}
/*!
* Control creation for DIALOG_PLOT_SCHEMATIC_PDF
*/
void DIALOG_PLOT_SCHEMATIC_PDF::initDlg()
{
SetFocus(); // make the ESC work
// Set options
m_SizeOption->SetSelection( m_pageSizeSelect );
m_PlotPDFColorOption->SetSelection( m_plotColorOpt ? 1 : 0 );
m_Plot_Sheet_Ref_Ctrl->SetValue( m_plot_Sheet_Ref );
AddUnitSymbol( *m_defaultLineWidthTitle, g_UserUnit );
PutValueInLocalUnits( *m_DefaultLineSizeCtrl, g_DrawDefaultLineThickness );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON
*/
void DIALOG_PLOT_SCHEMATIC_PDF::OnPlotCurrent( wxCommandEvent& event )
{
m_select_PlotAll = false;
initOptVars();
createPDFFile();
m_MsgBox->AppendText( wxT( "*****\n" ) );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1
*/
void DIALOG_PLOT_SCHEMATIC_PDF::OnPlotAll( wxCommandEvent& event )
{
m_select_PlotAll = true;
initOptVars();
createPDFFile();
m_MsgBox->AppendText( wxT( "*****\n" ) );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void DIALOG_PLOT_SCHEMATIC_PDF::OnCancelClick( wxCommandEvent& event )
{
initOptVars();
EndModal( 0 );
}
void DIALOG_PLOT_SCHEMATIC_PDF::initOptVars()
{
m_plot_Sheet_Ref = m_Plot_Sheet_Ref_Ctrl->GetValue();
m_plotColorOpt = m_PlotPDFColorOption->GetSelection();
m_pageSizeSelect = m_SizeOption->GetSelection();
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl );
if( g_DrawDefaultLineThickness < 1 )
g_DrawDefaultLineThickness = 1;
}
void DIALOG_PLOT_SCHEMATIC_PDF::createPDFFile()
{
SCH_SCREEN* screen = m_Parent->GetScreen();
SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); // sheetpath is saved here
wxPoint plot_offset;
/* When printing all pages, the printed page is not the current page. In
* complex hierarchies, we must update component references and others
* parameters in the given printed SCH_SCREEN, accordint to the sheet path
* because in complex hierarchies a SCH_SCREEN (a drawing ) is shared
* between many sheets and component references depend on the actual sheet
* path used
*/
SCH_SHEET_LIST SheetList( NULL );
sheetpath = SheetList.GetFirst();
// Allocate the plotter and set the job level parameter
PDF_PLOTTER* plotter = new PDF_PLOTTER();
plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness );
plotter->SetColorMode( m_plotColorOpt );
plotter->SetCreator( wxT( "Eeschema-PDF" ) );
plotter->SetPsTextMode( PSTEXTMODE_PHANTOM );
// First page handling is different
bool first_page = true;
do
{
// Step over the schematic hierarchy
if( m_select_PlotAll )
{
SCH_SHEET_PATH list;
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
m_Parent->SetCurrentSheet( list );
m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount();
screen = m_Parent->GetCurrentSheet().LastScreen();
}
else // Should not happen
wxASSERT( 0 );
sheetpath = SheetList.GetNext();
}
if( first_page ) {
wxString msg;
wxString plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet()
+ wxT( ".pdf" );
msg.Printf( _( "Plot: %s " ), GetChars( plotFileName ) );
m_MsgBox->AppendText( msg );
FILE* output_file = wxFopen( plotFileName, wxT( "wb" ) );
if( output_file == NULL )
{
msg = wxT( "\n** " );
msg += _( "Unable to create " ) + plotFileName + wxT( " **\n" );
m_MsgBox->AppendText( msg );
wxBell();
return;
}
// Open the plotter and do the first page
SetLocaleTo_C_standard();
plotter->SetFilename( plotFileName );
plotSetupPage( plotter, screen );
plotter->StartPlot( output_file );
first_page = false;
}
else
{
/* For the following pages you need to close the (finished) page,
reconfigure, and then start a new one */
plotter->ClosePage();
plotSetupPage( plotter, screen );
plotter->StartPage();
}
plotOneSheet( plotter, screen );
} while (m_select_PlotAll && sheetpath );
// Everything done, close the plot and restore the environment
plotter->EndPlot();
delete plotter;
SetLocaleTo_Default();
// Restore the previous sheet
m_Parent->SetCurrentSheet( oldsheetpath );
m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount();
}
void DIALOG_PLOT_SCHEMATIC_PDF::plotSetupPage( PDF_PLOTTER* plotter,
SCH_SCREEN* screen)
{
PAGE_INFO plotPage; // page size selected to plot
// Considerations on page size and scaling requests
PAGE_INFO actualPage = screen->GetPageSettings(); // page size selected in schematic
switch( m_pageSizeSelect )
{
case PAGE_SIZE_A:
plotPage.SetType( wxT( "A" ) );
plotPage.SetPortrait( actualPage.IsPortrait() );
break;
case PAGE_SIZE_A4:
plotPage.SetType( wxT( "A4" ) );
plotPage.SetPortrait( actualPage.IsPortrait() );
break;
case PAGE_SIZE_AUTO:
default:
plotPage = actualPage;
break;
}
double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
double scale = MIN( scalex, scaley );
plotter->SetViewport( wxPoint( 0, 0 ), IU_PER_DECIMILS, scale, 0 );
plotter->SetPageSettings( plotPage );
}
void DIALOG_PLOT_SCHEMATIC_PDF::plotOneSheet( PDF_PLOTTER* plotter,
SCH_SCREEN* screen )
{
if( m_plot_Sheet_Ref )
{
plotter->SetColor( BLACK );
m_Parent->PlotWorkSheet( plotter, screen );
}
screen->Plot( plotter );
}

View File

@ -0,0 +1,104 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_plot_schematic_PDF_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_PLOT_SCHEMATIC_PDF_BASE::DIALOG_PLOT_SCHEMATIC_PDF_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bmainSizer;
bmainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bupperSizer;
bupperSizer = new wxBoxSizer( wxHORIZONTAL );
wxString m_SizeOptionChoices[] = { _("Schematic size"), _("Force size A4"), _("Force size A") };
int m_SizeOptionNChoices = sizeof( m_SizeOptionChoices ) / sizeof( wxString );
m_SizeOption = new wxRadioBox( this, wxID_ANY, _("Plot Page Size:"), wxDefaultPosition, wxDefaultSize, m_SizeOptionNChoices, m_SizeOptionChoices, 1, wxRA_SPECIFY_COLS );
m_SizeOption->SetSelection( 0 );
bupperSizer->Add( m_SizeOption, 1, wxALL, 5 );
bupperSizer->Add( 10, 10, 0, wxEXPAND, 5 );
wxBoxSizer* sbSizerMiddle;
sbSizerMiddle = new wxBoxSizer( wxVERTICAL );
wxString m_PlotPDFColorOptionChoices[] = { _("B/W"), _("Color") };
int m_PlotPDFColorOptionNChoices = sizeof( m_PlotPDFColorOptionChoices ) / sizeof( wxString );
m_PlotPDFColorOption = new wxRadioBox( this, wxID_ANY, _("Plot Mode:"), wxDefaultPosition, wxDefaultSize, m_PlotPDFColorOptionNChoices, m_PlotPDFColorOptionChoices, 1, wxRA_SPECIFY_COLS );
m_PlotPDFColorOption->SetSelection( 0 );
sbSizerMiddle->Add( m_PlotPDFColorOption, 0, wxALL|wxEXPAND, 5 );
m_Plot_Sheet_Ref_Ctrl = new wxCheckBox( this, wxID_ANY, _("Print page references"), wxDefaultPosition, wxDefaultSize, 0 );
m_Plot_Sheet_Ref_Ctrl->SetValue(true);
sbSizerMiddle->Add( m_Plot_Sheet_Ref_Ctrl, 0, wxALL|wxEXPAND, 5 );
bupperSizer->Add( sbSizerMiddle, 1, wxEXPAND, 5 );
bupperSizer->Add( 10, 10, 0, wxEXPAND, 5 );
wxBoxSizer* bbuttonsSizer;
bbuttonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonPlotPage = new wxButton( this, wxID_ANY, _("&Plot Page"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPlotPage, 0, wxALL|wxEXPAND, 5 );
m_buttonPlotAll = new wxButton( this, wxID_ANY, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPlotAll, 0, wxALL|wxEXPAND, 5 );
m_buttonClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonClose, 0, wxALL|wxEXPAND, 5 );
bupperSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
bmainSizer->Add( bupperSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bSizerLineWidth;
bSizerLineWidth = new wxBoxSizer( wxHORIZONTAL );
m_defaultLineWidthTitle = new wxStaticText( this, wxID_ANY, _("Default line width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_defaultLineWidthTitle->Wrap( -1 );
bSizerLineWidth->Add( m_defaultLineWidthTitle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_DefaultLineSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerLineWidth->Add( m_DefaultLineSizeCtrl, 1, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
bmainSizer->Add( bSizerLineWidth, 0, wxEXPAND, 5 );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bmainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_MsgBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_MsgBox->SetMinSize( wxSize( -1,150 ) );
bmainSizer->Add( m_MsgBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
this->SetSizer( bmainSizer );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_buttonPlotPage->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnPlotCurrent ), NULL, this );
m_buttonPlotAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnPlotAll ), NULL, this );
m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnCancelClick ), NULL, this );
}
DIALOG_PLOT_SCHEMATIC_PDF_BASE::~DIALOG_PLOT_SCHEMATIC_PDF_BASE()
{
// Disconnect Events
m_buttonPlotPage->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnPlotCurrent ), NULL, this );
m_buttonPlotAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnPlotAll ), NULL, this );
m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnCancelClick ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,63 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_plot_schematic_PDF_base__
#define __dialog_plot_schematic_PDF_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/checkbox.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PLOT_SCHEMATIC_PDF_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PLOT_SCHEMATIC_PDF_BASE : public wxDialog
{
private:
protected:
wxRadioBox* m_SizeOption;
wxRadioBox* m_PlotPDFColorOption;
wxCheckBox* m_Plot_Sheet_Ref_Ctrl;
wxButton* m_buttonPlotPage;
wxButton* m_buttonPlotAll;
wxButton* m_buttonClose;
wxStaticText* m_defaultLineWidthTitle;
wxTextCtrl* m_DefaultLineSizeCtrl;
wxStaticText* m_staticText1;
wxTextCtrl* m_MsgBox;
// Virtual event handlers, overide them in your derived class
virtual void OnPlotCurrent( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPlotAll( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PLOT_SCHEMATIC_PDF_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot PDF"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 387,365 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_SCHEMATIC_PDF_BASE();
};
#endif //__dialog_plot_schematic_PDF_base__

View File

@ -237,7 +237,7 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
double scale = 10 * MIN( scalex, scaley );
double scale = MIN( scalex, scaley );
plot_offset.x = 0;
plot_offset.y = 0;
@ -281,24 +281,25 @@ void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
PS_PLOTTER* plotter = new PS_PLOTTER();
plotter->SetPageSettings( pageInfo );
plotter->set_viewport( plot_offset, scale, 0 );
plotter->set_default_line_width( g_DrawDefaultLineThickness );
plotter->set_color_mode( m_plotColorOpt );
plotter->SetViewport( plot_offset, IU_PER_DECIMILS, scale, 0 );
plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness );
plotter->SetColorMode( m_plotColorOpt );
plotter->SetPsTextMode( PSTEXTMODE_STROKE );
// Init :
plotter->set_creator( wxT( "Eeschema-PS" ) );
plotter->set_filename( FileName );
plotter->start_plot( output_file );
plotter->SetCreator( wxT( "Eeschema-PS" ) );
plotter->SetFilename( FileName );
plotter->StartPlot( output_file );
if( m_plot_Sheet_Ref )
{
plotter->set_color( BLACK );
plotter->SetColor( BLACK );
m_Parent->PlotWorkSheet( plotter, screen );
}
screen->Plot( plotter );
plotter->end_plot();
plotter->EndPlot();
delete plotter;
SetLocaleTo_Default();

View File

@ -55,6 +55,7 @@
#define FR_HISTORY_LIST_CNT 10 ///< Maximum number of find and replace strings.
int g_DefaultBusWidth = 9;
void LIB_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
{
@ -207,6 +208,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
dlg.SetUnits( units, g_UserUnit );
dlg.SetGridSizes( grid_list, GetScreen()->GetGridId() );
dlg.SetBusWidth( g_DefaultBusWidth );
dlg.SetLineWidth( g_DrawDefaultLineThickness );
dlg.SetTextSize( g_DefaultTextLabelSize );
dlg.SetRepeatHorizontal( g_RepeatStep.x );
@ -240,6 +242,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
GetScreen()->SetGrid( grid_list[ (size_t) dlg.GetGridSelection() ].m_Size );
g_DefaultBusWidth = dlg.GetBusWidth();
g_DrawDefaultLineThickness = dlg.GetLineWidth();
g_DefaultTextLabelSize = dlg.GetTextSize();
g_RepeatStep.x = dlg.GetRepeatHorizontal();
@ -420,7 +423,7 @@ void SCH_EDIT_FRAME::SaveProjectFile()
wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() );
}
static const wxString DefaultBusWidthEntry( wxT( "DefaultBusWidth" ) );
static const wxString DefaultDrawLineWidthEntry( wxT( "DefaultDrawLineWidth" ) );
static const wxString ShowHiddenPinsEntry( wxT( "ShowHiddenPins" ) );
static const wxString HorzVertLinesOnlyEntry( wxT( "HorizVertLinesOnly" ) );
@ -553,6 +556,7 @@ void SCH_EDIT_FRAME::LoadSettings()
// This is required until someone gets rid of the global variable g_LayerDescription().
m_GridColor = g_LayerDescr.LayerColor[LAYER_GRID];
g_DefaultBusWidth = cfg->Read( DefaultBusWidthEntry, (long) 8 );
g_DrawDefaultLineThickness = cfg->Read( DefaultDrawLineWidthEntry,(long) 6 );
cfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false );
cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true );
@ -644,6 +648,7 @@ void SCH_EDIT_FRAME::SaveSettings()
wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
cfg->Write( DefaultBusWidthEntry, (long) g_DefaultBusWidth );
cfg->Write( DefaultDrawLineWidthEntry, (long) g_DrawDefaultLineThickness );
cfg->Write( ShowHiddenPinsEntry, m_showAllPins );
cfg->Write( HorzVertLinesOnlyEntry, g_HVLines );

View File

@ -8,7 +8,10 @@
#define GROUPCOMMON wxT( "/common" )
#define GROUPLIB wxT( "libraries" )
extern int g_PenMinWidth;
/**
* The width given to bus drawings that do not have a specific width
*/
extern int g_DefaultBusWidth;
/* saving parameters option : */
#define INSETUP true /* used when the parameter is saved in general config

File diff suppressed because it is too large Load Diff

View File

@ -270,12 +270,12 @@ void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
aPlotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 );
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
aPlotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->PlotPoly( cornerList, already_filled ? NO_FILL : m_Fill, GetPenSize() );
}

View File

@ -1,355 +1,355 @@
/*
* 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) 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 lib_circle.cpp
* @brief LIB_CIRCLE class implementation.
*/
#include <fctsys.h>
#include <gr_basic.h>
#include <macros.h>
#include <class_drawpanel.h>
#include <plot_common.h>
#include <trigo.h>
#include <wxstruct.h>
#include <richio.h>
#include <base_units.h>
#include <general.h>
#include <protos.h>
#include <lib_circle.h>
#include <transform.h>
LIB_CIRCLE::LIB_CIRCLE( LIB_COMPONENT* aParent ) :
LIB_ITEM( LIB_CIRCLE_T, aParent )
{
m_Radius = 0;
m_Width = 0;
m_Fill = NO_FILL;
m_isFillable = true;
m_typeName = _( "Circle" );
}
bool LIB_CIRCLE::Save( OUTPUTFORMATTER& aFormatter )
{
aFormatter.Print( 0, "C %d %d %d %d %d %d %c\n", m_Pos.x, m_Pos.y,
m_Radius, m_Unit, m_Convert, m_Width, fill_tab[m_Fill] );
return true;
}
bool LIB_CIRCLE::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
{
char tmp[256];
char* line = (char*) aLineReader;
int cnt = sscanf( line + 2, "%d %d %d %d %d %d %s", &m_Pos.x, &m_Pos.y,
&m_Radius, &m_Unit, &m_Convert, &m_Width, tmp );
if( cnt < 6 )
{
aErrorMsg.Printf( _( "circle only had %d parameters of the required 6" ), cnt );
return false;
}
if( tmp[0] == 'F' )
m_Fill = FILLED_SHAPE;
if( tmp[0] == 'f' )
m_Fill = FILLED_WITH_BG_BODYCOLOR;
return true;
}
bool LIB_CIRCLE::HitTest( const wxPoint& aPosRef )
{
int mindist = GetPenSize() / 2;
// Have a minimal tolerance for hit test
if( mindist < MINIMUM_SELECTION_DISTANCE )
mindist = MINIMUM_SELECTION_DISTANCE;
return HitTest( aPosRef, mindist, DefaultTransform );
}
bool LIB_CIRCLE::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform )
{
if( aThreshold < 0 )
aThreshold = GetPenSize() / 2;
wxPoint relpos = aPosRef - aTransform.TransformCoordinate( m_Pos );
int dist = KiROUND( sqrt( ( (double) relpos.x * relpos.x ) +
( (double) relpos.y * relpos.y ) ) );
if( abs( dist - m_Radius ) <= aThreshold )
return true;
return false;
}
EDA_ITEM* LIB_CIRCLE::Clone() const
{
return new LIB_CIRCLE( *this );
}
int LIB_CIRCLE::compare( const LIB_ITEM& aOther ) const
{
wxASSERT( aOther.Type() == LIB_CIRCLE_T );
const LIB_CIRCLE* tmp = ( LIB_CIRCLE* ) &aOther;
if( m_Pos.x != tmp->m_Pos.x )
return m_Pos.x - tmp->m_Pos.x;
if( m_Pos.y != tmp->m_Pos.y )
return m_Pos.y - tmp->m_Pos.y;
if( m_Radius != tmp->m_Radius )
return m_Radius - tmp->m_Radius;
return 0;
}
void LIB_CIRCLE::SetOffset( const wxPoint& aOffset )
{
m_Pos += aOffset;
}
bool LIB_CIRCLE::Inside( EDA_RECT& aRect ) const
{
/*
* FIXME: This fails to take into account the radius around the center
* point.
*/
return aRect.Contains( m_Pos.x, -m_Pos.y );
}
void LIB_CIRCLE::Move( const wxPoint& aPosition )
{
m_Pos = aPosition;
}
void LIB_CIRCLE::MirrorHorizontal( const wxPoint& aCenter )
{
m_Pos.x -= aCenter.x;
m_Pos.x *= -1;
m_Pos.x += aCenter.x;
}
void LIB_CIRCLE::MirrorVertical( const wxPoint& aCenter )
{
m_Pos.y -= aCenter.y;
m_Pos.y *= -1;
m_Pos.y += aCenter.y;
}
void LIB_CIRCLE::Rotate( const wxPoint& aCenter, bool aRotateCCW )
{
int rot_angle = aRotateCCW ? -900 : 900;
RotatePoint( &m_Pos, aCenter, rot_angle );
}
void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform )
{
wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + aOffset;
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
aPlotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->circle( pos, m_Radius * 2, FILLED_SHAPE, 0 );
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
aPlotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->circle( pos, m_Radius * 2, already_filled ? NO_FILL : m_Fill, GetPenSize() );
}
int LIB_CIRCLE::GetPenSize() const
{
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
}
void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform )
{
wxPoint pos1;
int color = ReturnLayerColor( LAYER_DEVICE );
if( aColor < 0 ) // Used normal color or selected color
{
if( IsSelected() )
color = g_ItemSelectetColor;
}
else
{
color = aColor;
}
pos1 = aTransform.TransformCoordinate( m_Pos ) + aOffset;
GRSetDrawMode( aDC, aDrawMode );
FILL_T fill = aData ? NO_FILL : m_Fill;
if( aColor >= 0 )
fill = NO_FILL;
if( fill == FILLED_WITH_BG_BODYCOLOR )
GRFilledCircle( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, m_Radius, GetPenSize(),
(m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ),
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( fill == FILLED_SHAPE )
GRFilledCircle( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, m_Radius, 0, color, color );
else
GRCircle( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, m_Radius, GetPenSize(), color );
/* Set to one (1) to draw bounding box around circle to validate bounding
* box calculation. */
#if 0
EDA_RECT bBox = GetBoundingBox();
GRRect( aPanel->GetClipBox(), aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
}
EDA_RECT LIB_CIRCLE::GetBoundingBox() const
{
EDA_RECT rect;
rect.SetOrigin( m_Pos.x - m_Radius, ( m_Pos.y - m_Radius ) * -1 );
rect.SetEnd( m_Pos.x + m_Radius, ( m_Pos.y + m_Radius ) * -1 );
rect.Inflate( m_Width / 2, m_Width / 2 );
return rect;
}
void LIB_CIRCLE::DisplayInfo( EDA_DRAW_FRAME* aFrame )
{
wxString msg;
EDA_RECT bBox = GetBoundingBox();
LIB_ITEM::DisplayInfo( aFrame );
msg = ReturnStringFromValue( g_UserUnit, m_Width, true );
aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE );
msg = ReturnStringFromValue( g_UserUnit, m_Radius, true );
aFrame->AppendMsgPanel( _( "Radius" ), msg, RED );
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
aFrame->AppendMsgPanel( _( "Bounding box" ), msg, BROWN );
}
wxString LIB_CIRCLE::GetSelectMenuText() const
{
return wxString::Format( _( "Circle center (%s, %s), radius %s" ),
GetChars( CoordinateToString( m_Pos.x ) ),
GetChars( CoordinateToString( m_Pos.y ) ),
GetChars( CoordinateToString( m_Radius ) ) );
}
void LIB_CIRCLE::BeginEdit( int aEditMode, const wxPoint aPosition )
{
wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0,
wxT( "Invalid edit mode for LIB_CIRCLE object." ) );
if( aEditMode == IS_NEW )
{
m_Pos = m_initialPos = aPosition;
}
else if( aEditMode == IS_MOVED )
{
m_initialPos = m_Pos;
m_initialCursorPos = aPosition;
SetEraseLastDrawItem();
}
else if( aEditMode == IS_RESIZED )
{
SetEraseLastDrawItem();
}
m_Flags = aEditMode;
}
bool LIB_CIRCLE::ContinueEdit( const wxPoint aPosition )
{
wxCHECK_MSG( ( m_Flags & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0, false,
wxT( "Bad call to ContinueEdit(). LIB_CIRCLE is not being edited." ) );
return false;
}
void LIB_CIRCLE::EndEdit( const wxPoint& aPosition, bool aAbort )
{
wxCHECK_RET( ( m_Flags & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0,
wxT( "Bad call to EndEdit(). LIB_CIRCLE is not being edited." ) );
SetEraseLastDrawItem( false );
m_Flags = 0;
}
void LIB_CIRCLE::calcEdit( const wxPoint& aPosition )
{
if( m_Flags == IS_NEW || m_Flags == IS_RESIZED )
{
if( m_Flags == IS_NEW )
SetEraseLastDrawItem();
int dx = m_Pos.x - aPosition.x;
int dy = m_Pos.y - aPosition.y;
m_Radius = KiROUND( sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) ) );
}
else
{
Move( m_initialPos + aPosition - m_initialCursorPos );
}
}
/*
* 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) 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 lib_circle.cpp
* @brief LIB_CIRCLE class implementation.
*/
#include <fctsys.h>
#include <gr_basic.h>
#include <macros.h>
#include <class_drawpanel.h>
#include <plot_common.h>
#include <trigo.h>
#include <wxstruct.h>
#include <richio.h>
#include <base_units.h>
#include <general.h>
#include <protos.h>
#include <lib_circle.h>
#include <transform.h>
LIB_CIRCLE::LIB_CIRCLE( LIB_COMPONENT* aParent ) :
LIB_ITEM( LIB_CIRCLE_T, aParent )
{
m_Radius = 0;
m_Width = 0;
m_Fill = NO_FILL;
m_isFillable = true;
m_typeName = _( "Circle" );
}
bool LIB_CIRCLE::Save( OUTPUTFORMATTER& aFormatter )
{
aFormatter.Print( 0, "C %d %d %d %d %d %d %c\n", m_Pos.x, m_Pos.y,
m_Radius, m_Unit, m_Convert, m_Width, fill_tab[m_Fill] );
return true;
}
bool LIB_CIRCLE::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
{
char tmp[256];
char* line = (char*) aLineReader;
int cnt = sscanf( line + 2, "%d %d %d %d %d %d %s", &m_Pos.x, &m_Pos.y,
&m_Radius, &m_Unit, &m_Convert, &m_Width, tmp );
if( cnt < 6 )
{
aErrorMsg.Printf( _( "circle only had %d parameters of the required 6" ), cnt );
return false;
}
if( tmp[0] == 'F' )
m_Fill = FILLED_SHAPE;
if( tmp[0] == 'f' )
m_Fill = FILLED_WITH_BG_BODYCOLOR;
return true;
}
bool LIB_CIRCLE::HitTest( const wxPoint& aPosRef )
{
int mindist = GetPenSize() / 2;
// Have a minimal tolerance for hit test
if( mindist < MINIMUM_SELECTION_DISTANCE )
mindist = MINIMUM_SELECTION_DISTANCE;
return HitTest( aPosRef, mindist, DefaultTransform );
}
bool LIB_CIRCLE::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform )
{
if( aThreshold < 0 )
aThreshold = GetPenSize() / 2;
wxPoint relpos = aPosRef - aTransform.TransformCoordinate( m_Pos );
int dist = KiROUND( sqrt( ( (double) relpos.x * relpos.x ) +
( (double) relpos.y * relpos.y ) ) );
if( abs( dist - m_Radius ) <= aThreshold )
return true;
return false;
}
EDA_ITEM* LIB_CIRCLE::Clone() const
{
return new LIB_CIRCLE( *this );
}
int LIB_CIRCLE::compare( const LIB_ITEM& aOther ) const
{
wxASSERT( aOther.Type() == LIB_CIRCLE_T );
const LIB_CIRCLE* tmp = ( LIB_CIRCLE* ) &aOther;
if( m_Pos.x != tmp->m_Pos.x )
return m_Pos.x - tmp->m_Pos.x;
if( m_Pos.y != tmp->m_Pos.y )
return m_Pos.y - tmp->m_Pos.y;
if( m_Radius != tmp->m_Radius )
return m_Radius - tmp->m_Radius;
return 0;
}
void LIB_CIRCLE::SetOffset( const wxPoint& aOffset )
{
m_Pos += aOffset;
}
bool LIB_CIRCLE::Inside( EDA_RECT& aRect ) const
{
/*
* FIXME: This fails to take into account the radius around the center
* point.
*/
return aRect.Contains( m_Pos.x, -m_Pos.y );
}
void LIB_CIRCLE::Move( const wxPoint& aPosition )
{
m_Pos = aPosition;
}
void LIB_CIRCLE::MirrorHorizontal( const wxPoint& aCenter )
{
m_Pos.x -= aCenter.x;
m_Pos.x *= -1;
m_Pos.x += aCenter.x;
}
void LIB_CIRCLE::MirrorVertical( const wxPoint& aCenter )
{
m_Pos.y -= aCenter.y;
m_Pos.y *= -1;
m_Pos.y += aCenter.y;
}
void LIB_CIRCLE::Rotate( const wxPoint& aCenter, bool aRotateCCW )
{
int rot_angle = aRotateCCW ? -900 : 900;
RotatePoint( &m_Pos, aCenter, rot_angle );
}
void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform )
{
wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + aOffset;
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->Circle( pos, m_Radius * 2, FILLED_SHAPE, 0 );
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->Circle( pos, m_Radius * 2, already_filled ? NO_FILL : m_Fill, GetPenSize() );
}
int LIB_CIRCLE::GetPenSize() const
{
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
}
void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform )
{
wxPoint pos1;
int color = ReturnLayerColor( LAYER_DEVICE );
if( aColor < 0 ) // Used normal color or selected color
{
if( IsSelected() )
color = g_ItemSelectetColor;
}
else
{
color = aColor;
}
pos1 = aTransform.TransformCoordinate( m_Pos ) + aOffset;
GRSetDrawMode( aDC, aDrawMode );
FILL_T fill = aData ? NO_FILL : m_Fill;
if( aColor >= 0 )
fill = NO_FILL;
if( fill == FILLED_WITH_BG_BODYCOLOR )
GRFilledCircle( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, m_Radius, GetPenSize(),
(m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ),
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( fill == FILLED_SHAPE )
GRFilledCircle( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, m_Radius, 0, color, color );
else
GRCircle( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, m_Radius, GetPenSize(), color );
/* Set to one (1) to draw bounding box around circle to validate bounding
* box calculation. */
#if 0
EDA_RECT bBox = GetBoundingBox();
GRRect( aPanel->GetClipBox(), aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
}
EDA_RECT LIB_CIRCLE::GetBoundingBox() const
{
EDA_RECT rect;
rect.SetOrigin( m_Pos.x - m_Radius, ( m_Pos.y - m_Radius ) * -1 );
rect.SetEnd( m_Pos.x + m_Radius, ( m_Pos.y + m_Radius ) * -1 );
rect.Inflate( m_Width / 2, m_Width / 2 );
return rect;
}
void LIB_CIRCLE::DisplayInfo( EDA_DRAW_FRAME* aFrame )
{
wxString msg;
EDA_RECT bBox = GetBoundingBox();
LIB_ITEM::DisplayInfo( aFrame );
msg = ReturnStringFromValue( g_UserUnit, m_Width, true );
aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE );
msg = ReturnStringFromValue( g_UserUnit, m_Radius, true );
aFrame->AppendMsgPanel( _( "Radius" ), msg, RED );
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
aFrame->AppendMsgPanel( _( "Bounding box" ), msg, BROWN );
}
wxString LIB_CIRCLE::GetSelectMenuText() const
{
return wxString::Format( _( "Circle center (%s, %s), radius %s" ),
GetChars( CoordinateToString( m_Pos.x ) ),
GetChars( CoordinateToString( m_Pos.y ) ),
GetChars( CoordinateToString( m_Radius ) ) );
}
void LIB_CIRCLE::BeginEdit( int aEditMode, const wxPoint aPosition )
{
wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0,
wxT( "Invalid edit mode for LIB_CIRCLE object." ) );
if( aEditMode == IS_NEW )
{
m_Pos = m_initialPos = aPosition;
}
else if( aEditMode == IS_MOVED )
{
m_initialPos = m_Pos;
m_initialCursorPos = aPosition;
SetEraseLastDrawItem();
}
else if( aEditMode == IS_RESIZED )
{
SetEraseLastDrawItem();
}
m_Flags = aEditMode;
}
bool LIB_CIRCLE::ContinueEdit( const wxPoint aPosition )
{
wxCHECK_MSG( ( m_Flags & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0, false,
wxT( "Bad call to ContinueEdit(). LIB_CIRCLE is not being edited." ) );
return false;
}
void LIB_CIRCLE::EndEdit( const wxPoint& aPosition, bool aAbort )
{
wxCHECK_RET( ( m_Flags & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0,
wxT( "Bad call to EndEdit(). LIB_CIRCLE is not being edited." ) );
SetEraseLastDrawItem( false );
m_Flags = 0;
}
void LIB_CIRCLE::calcEdit( const wxPoint& aPosition )
{
if( m_Flags == IS_NEW || m_Flags == IS_RESIZED )
{
if( m_Flags == IS_NEW )
SetEraseLastDrawItem();
int dx = m_Pos.x - aPosition.x;
int dy = m_Pos.y - aPosition.y;
m_Radius = KiROUND( sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) ) );
}
else
{
Move( m_initialPos + aPosition - m_initialCursorPos );
}
}

View File

@ -1275,7 +1275,7 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
color = ReturnLayerColor( LAYER_PIN );
aPlotter->set_color( color );
aPlotter->SetColor( color );
MapX1 = MapY1 = 0;
x1 = aPosition.x; y1 = aPosition.y;
@ -1305,35 +1305,35 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
if( m_shape & INVERT )
{
aPlotter->circle( wxPoint( MapX1 * INVERT_PIN_RADIUS + x1,
aPlotter->Circle( wxPoint( MapX1 * INVERT_PIN_RADIUS + x1,
MapY1 * INVERT_PIN_RADIUS + y1 ),
INVERT_PIN_RADIUS * 2, // diameter
NO_FILL, // fill
-1 ); // width
aPlotter->move_to( wxPoint( MapX1 * INVERT_PIN_RADIUS * 2 + x1,
aPlotter->MoveTo( wxPoint( MapX1 * INVERT_PIN_RADIUS * 2 + x1,
MapY1 * INVERT_PIN_RADIUS * 2 + y1 ) );
aPlotter->finish_to( aPosition );
aPlotter->FinishTo( aPosition );
}
else
{
aPlotter->move_to( wxPoint( x1, y1 ) );
aPlotter->finish_to( aPosition );
aPlotter->MoveTo( wxPoint( x1, y1 ) );
aPlotter->FinishTo( aPosition );
}
if( m_shape & CLOCK )
{
if( MapY1 == 0 ) /* MapX1 = +- 1 */
{
aPlotter->move_to( wxPoint( x1, y1 + CLOCK_PIN_DIM ) );
aPlotter->line_to( wxPoint( x1 - MapX1 * CLOCK_PIN_DIM, y1 ) );
aPlotter->finish_to( wxPoint( x1, y1 - CLOCK_PIN_DIM ) );
aPlotter->MoveTo( wxPoint( x1, y1 + CLOCK_PIN_DIM ) );
aPlotter->LineTo( wxPoint( x1 - MapX1 * CLOCK_PIN_DIM, y1 ) );
aPlotter->FinishTo( wxPoint( x1, y1 - CLOCK_PIN_DIM ) );
}
else /* MapX1 = 0 */
{
aPlotter->move_to( wxPoint( x1 + CLOCK_PIN_DIM, y1 ) );
aPlotter->line_to( wxPoint( x1, y1 - MapY1 * CLOCK_PIN_DIM ) );
aPlotter->finish_to( wxPoint( x1 - CLOCK_PIN_DIM, y1 ) );
aPlotter->MoveTo( wxPoint( x1 + CLOCK_PIN_DIM, y1 ) );
aPlotter->LineTo( wxPoint( x1, y1 - MapY1 * CLOCK_PIN_DIM ) );
aPlotter->FinishTo( wxPoint( x1 - CLOCK_PIN_DIM, y1 ) );
}
}
@ -1341,17 +1341,17 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
{
if( MapY1 == 0 ) /* MapX1 = +- 1 */
{
aPlotter->move_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ) );
aPlotter->line_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
aPlotter->MoveTo( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ) );
aPlotter->LineTo( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
y1 - IEEE_SYMBOL_PIN_DIM ) );
aPlotter->finish_to( wxPoint( x1, y1 ) );
aPlotter->FinishTo( wxPoint( x1, y1 ) );
}
else /* MapX1 = 0 */
{
aPlotter->move_to( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
aPlotter->line_to( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM,
aPlotter->MoveTo( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
aPlotter->LineTo( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM,
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
aPlotter->finish_to( wxPoint( x1, y1 ) );
aPlotter->FinishTo( wxPoint( x1, y1 ) );
}
}
@ -1360,13 +1360,13 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
{
if( MapY1 == 0 ) /* MapX1 = +- 1 */
{
aPlotter->move_to( wxPoint( x1, y1 - IEEE_SYMBOL_PIN_DIM ) );
aPlotter->finish_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ) );
aPlotter->MoveTo( wxPoint( x1, y1 - IEEE_SYMBOL_PIN_DIM ) );
aPlotter->FinishTo( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ) );
}
else /* MapX1 = 0 */
{
aPlotter->move_to( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM, y1 ) );
aPlotter->finish_to( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
aPlotter->MoveTo( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM, y1 ) );
aPlotter->FinishTo( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
}
}
}
@ -1427,7 +1427,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
if( orient == PIN_RIGHT )
{
x = x1 + TextInside;
plotter->text( wxPoint( x, y1 ), NameColor,
plotter->Text( wxPoint( x, y1 ), NameColor,
m_name,
TEXT_ORIENT_HORIZ,
PinNameSize,
@ -1440,7 +1440,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
x = x1 - TextInside;
if( DrawPinName )
plotter->text( wxPoint( x, y1 ),
plotter->Text( wxPoint( x, y1 ),
NameColor, m_name, TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT,
@ -1450,7 +1450,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
}
if( DrawPinNum )
{
plotter->text( wxPoint( (x1 + pin_pos.x) / 2, y1 - TXTMARGE ),
plotter->Text( wxPoint( (x1 + pin_pos.x) / 2, y1 - TXTMARGE ),
NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
@ -1465,7 +1465,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
y = y1 + TextInside;
if( DrawPinName )
plotter->text( wxPoint( x1, y ), NameColor,
plotter->Text( wxPoint( x1, y ), NameColor,
m_name,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT,
@ -1474,7 +1474,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
if( DrawPinNum )
{
plotter->text( wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ),
plotter->Text( wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
@ -1487,7 +1487,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
y = y1 - TextInside;
if( DrawPinName )
plotter->text( wxPoint( x1, y ), NameColor,
plotter->Text( wxPoint( x1, y ), NameColor,
m_name,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_LEFT,
@ -1496,7 +1496,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
if( DrawPinNum )
{
plotter->text( wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ),
plotter->Text( wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
@ -1514,7 +1514,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
if( DrawPinName )
{
x = (x1 + pin_pos.x) / 2;
plotter->text( wxPoint( x, y1 - TXTMARGE ),
plotter->Text( wxPoint( x, y1 - TXTMARGE ),
NameColor, m_name,
TEXT_ORIENT_HORIZ, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER,
@ -1525,7 +1525,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
if( DrawPinNum )
{
x = ( x1 + pin_pos.x ) / 2;
plotter->text( wxPoint( x, y1 + TXTMARGE ),
plotter->Text( wxPoint( x, y1 + TXTMARGE ),
NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
@ -1538,7 +1538,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
if( DrawPinName )
{
y = ( y1 + pin_pos.y ) / 2;
plotter->text( wxPoint( x1 - TXTMARGE, y ),
plotter->Text( wxPoint( x1 - TXTMARGE, y ),
NameColor, m_name,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER,
@ -1548,7 +1548,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
if( DrawPinNum )
{
plotter->text( wxPoint( x1 + TXTMARGE, ( y1 + pin_pos.y ) / 2 ),
plotter->Text( wxPoint( x1 + TXTMARGE, ( y1 + pin_pos.y ) / 2 ),
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
@ -1808,7 +1808,7 @@ void LIB_PIN::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
wxPoint pos = aTransform.TransformCoordinate( m_position ) + offset;
plotter->set_current_line_width( GetPenSize() );
plotter->SetCurrentLineWidth( GetPenSize() );
PlotSymbol( plotter, pos, orient );
PlotPinTexts( plotter, pos, orient, GetParent()->GetPinNameOffset(),
GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(),

View File

@ -241,13 +241,13 @@ void LIB_POLYLINE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
aPlotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 );
aFill = false; // body is now filled, do not fill it later.
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
aPlotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->PlotPoly( cornerList, already_filled ? NO_FILL : m_Fill, GetPenSize() );
}

View File

@ -178,13 +178,13 @@ void LIB_RECTANGLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
aPlotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->rect( pos, end, FILLED_WITH_BG_BODYCOLOR, 0 );
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->Rect( pos, end, FILLED_WITH_BG_BODYCOLOR, 0 );
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
aPlotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->rect( pos, end, already_filled ? NO_FILL : m_Fill, GetPenSize() );
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->Rect( pos, end, already_filled ? NO_FILL : m_Fill, GetPenSize() );
}

View File

@ -318,7 +318,7 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
int t1 = ( aTransform.x1 != 0 ) ^ ( m_Orient != 0 );
wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + offset;
plotter->text( pos, UNSPECIFIED, m_Text,
plotter->Text( pos, UNSPECIFIED, m_Text,
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
m_Size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
GetPenSize(), m_Italic, m_Bold );

View File

@ -204,6 +204,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
m_tempCopyComponent = NULL;
m_HotkeysZoomAndGridList = s_Libedit_Hokeys_Descr;
m_editPinsPerPartOrConvert = false;
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
wxIcon icon;
@ -219,12 +220,10 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
LoadSettings();
// Initialize grid id to a default value if not found in config or bad:
if( (m_LastGridSizeId <= 0)
|| ( m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000) ) )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
// Initialize grid id to the default value 50 mils:
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
if( m_canvas )

View File

@ -347,7 +347,7 @@ line %d,\nAbort reading file.\n" ),
if( strnicmp( line, "Sheet", 2 ) == 0 )
sscanf( line + 5, " %d %d",
&aScreen->m_ScreenNumber, &aScreen->m_NumberOfScreen );
&aScreen->m_ScreenNumber, &aScreen->m_NumberOfScreens );
if( strnicmp( line, "Title", 2 ) == 0 )
{

View File

@ -147,6 +147,12 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
_( "Plot schematic sheet in PostScript format" ),
KiBitmap( plot_ps_xpm ) );
// Plot PDF
AddMenuItem( choice_plot_fmt, ID_GEN_PLOT_PDF,
_( "Plot PDF" ),
_( "Plot schematic sheet in PDF format" ),
KiBitmap( plot_pdf_xpm ) );
// Plot HPGL
AddMenuItem( choice_plot_fmt,
ID_GEN_PLOT_HPGL,

View File

@ -73,7 +73,7 @@ private:
SCH_SHEET_PATH m_SheetPath; ///< The sheet path for this reference.
bool m_IsNew; ///< True if not yet annotated.
int m_SheetNum; ///< The sheet number for the reference.
unsigned long m_TimeStamp; ///< The time stamp for the reference.
time_t m_TimeStamp; ///< The time stamp for the reference.
wxString* m_Value; ///< The component value of the refernce. It is the
///< same for all instances.
int m_NumRef; ///< The numeric part of the reference designator.

View File

@ -36,6 +36,7 @@
#include <richio.h>
#include <plot_common.h>
#include <eeschema_config.h>
#include <general.h>
#include <protos.h>
#include <sch_bus_entry.h>
@ -167,10 +168,9 @@ int SCH_BUS_ENTRY::GetPenSize() const
{
int pensize = ( m_width == 0 ) ? g_DrawDefaultLineThickness : m_width;
if( m_Layer == LAYER_BUS && m_width == 0 )
if( m_Layer == LAYER_BUS )
{
pensize = KiROUND( g_DrawDefaultLineThickness * BUS_WIDTH_EXPAND );
pensize = MAX( pensize, 3 );
pensize = ( m_width == 0 ) ? g_DefaultBusWidth : m_width;
}
return pensize;
@ -281,10 +281,10 @@ bool SCH_BUS_ENTRY::HitTest( const EDA_RECT& aRect, bool aContained, int aAccura
void SCH_BUS_ENTRY::Plot( PLOTTER* aPlotter )
{
aPlotter->set_current_line_width( GetPenSize() );
aPlotter->set_color( ReturnLayerColor( GetLayer() ) );
aPlotter->move_to( m_pos );
aPlotter->finish_to( m_End() );
aPlotter->SetCurrentLineWidth( GetPenSize() );
aPlotter->SetColor( ReturnLayerColor( GetLayer() ) );
aPlotter->MoveTo( m_pos );
aPlotter->FinishTo( m_End() );
}
/* SetBusEntryShape:

View File

@ -195,7 +195,7 @@ public:
* @see m_PathsAndReferences
* @param aNewTimeStamp = new time stamp
*/
void SetTimeStamp( long aNewTimeStamp );
void SetTimeStamp( time_t aNewTimeStamp );
EDA_RECT GetBoundingBox() const;

View File

@ -579,7 +579,7 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter )
if( (parent->GetPartCount() <= 1) || (m_id != REFERENCE) )
{
aPlotter->text( textpos, color, m_Text, orient, m_Size, hjustify, vjustify,
aPlotter->Text( textpos, color, m_Text, orient, m_Size, hjustify, vjustify,
thickness, m_Italic, m_Bold );
}
else /* We plot the reference, for a multiple parts per package */
@ -587,7 +587,7 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter )
/* Adding A, B ... to the reference */
wxString Text = m_Text + LIB_COMPONENT::ReturnSubReference( parent->GetUnit() );
aPlotter->text( textpos, color, Text, orient, m_Size, hjustify, vjustify,
aPlotter->Text( textpos, color, Text, orient, m_Size, hjustify, vjustify,
thickness, m_Italic, m_Bold );
}
}

View File

@ -238,6 +238,6 @@ bool SCH_JUNCTION::doIsConnected( const wxPoint& aPosition ) const
void SCH_JUNCTION::Plot( PLOTTER* aPlotter )
{
aPlotter->set_color( ReturnLayerColor( GetLayer() ) );
aPlotter->circle( m_pos, m_size.x, FILLED_SHAPE );
aPlotter->SetColor( ReturnLayerColor( GetLayer() ) );
aPlotter->Circle( m_pos, m_size.x, FILLED_SHAPE );
}

View File

@ -35,7 +35,7 @@
#include <richio.h>
#include <plot_common.h>
#include <base_units.h>
#include <eeschema_config.h>
#include <general.h>
#include <protos.h>
#include <sch_line.h>
@ -212,10 +212,9 @@ int SCH_LINE::GetPenSize() const
{
int pensize = ( m_width == 0 ) ? g_DrawDefaultLineThickness : m_width;
if( m_Layer == LAYER_BUS && m_width == 0 )
if( m_Layer == LAYER_BUS )
{
pensize = KiROUND( g_DrawDefaultLineThickness * BUS_WIDTH_EXPAND );
pensize = MAX( pensize, 3 );
pensize = ( m_width == 0 ) ? g_DefaultBusWidth : m_width;
}
return pensize;
@ -603,17 +602,17 @@ bool SCH_LINE::doIsConnected( const wxPoint& aPosition ) const
void SCH_LINE::Plot( PLOTTER* aPlotter )
{
aPlotter->set_color( ReturnLayerColor( GetLayer() ) );
aPlotter->set_current_line_width( GetPenSize() );
aPlotter->SetColor( ReturnLayerColor( GetLayer() ) );
aPlotter->SetCurrentLineWidth( GetPenSize() );
if( m_Layer == LAYER_NOTES )
aPlotter->set_dash( true );
aPlotter->SetDash( true );
aPlotter->move_to( m_start );
aPlotter->finish_to( m_end );
aPlotter->MoveTo( m_start );
aPlotter->FinishTo( m_end );
if( m_Layer == LAYER_NOTES )
aPlotter->set_dash( false );
aPlotter->SetDash( false );
}

View File

@ -241,10 +241,11 @@ void SCH_NO_CONNECT::Plot( PLOTTER* aPlotter )
pX = m_pos.x;
pY = m_pos.y;
aPlotter->set_current_line_width( GetPenSize() );
aPlotter->set_color( ReturnLayerColor( GetLayer() ) );
aPlotter->move_to( wxPoint( pX - delta, pY - delta ) );
aPlotter->finish_to( wxPoint( pX + delta, pY + delta ) );
aPlotter->move_to( wxPoint( pX + delta, pY - delta ) );
aPlotter->finish_to( wxPoint( pX - delta, pY + delta ) );
aPlotter->SetCurrentLineWidth( GetPenSize() );
aPlotter->SetColor( ReturnLayerColor( GetLayer() ) );
aPlotter->MoveTo( wxPoint( pX - delta, pY - delta ) );
aPlotter->FinishTo( wxPoint( pX + delta, pY + delta ) );
aPlotter->MoveTo( wxPoint( pX + delta, pY - delta ) );
aPlotter->FinishTo( wxPoint( pX - delta, pY + delta ) );
}

View File

@ -106,7 +106,7 @@ SCH_SCREEN::SCH_SCREEN() :
SetZoom( 32 );
for( i = 0; i < SCHEMATIC_ZOOM_LIST_CNT; i++ )
m_ZoomList.Add( SchematicZoomList[i] );
m_ZoomList.push_back( SchematicZoomList[i] );
for( i = 0; i < SCHEMATIC_GRID_LIST_CNT; i++ )
AddGrid( SchematicGridList[i] );
@ -146,8 +146,8 @@ void SCH_SCREEN::Clear()
{
FreeDrawList();
/* Clear the project settings. */
m_ScreenNumber = m_NumberOfScreen = 1;
// Clear the project settings
m_ScreenNumber = m_NumberOfScreens = 1;
m_titles.Clear();
m_titles.SetDate();
@ -507,7 +507,7 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
" portrait" : ""
) < 0
|| fprintf( aFile, "encoding utf-8\n") < 0
|| fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen ) < 0
|| fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreens ) < 0
|| fprintf( aFile, "Title %s\n", EscapedUTF8( tb.GetTitle() ).c_str() ) < 0
|| fprintf( aFile, "Date %s\n", EscapedUTF8( tb.GetDate() ).c_str() ) < 0
|| fprintf( aFile, "Rev %s\n", EscapedUTF8( tb.GetRevision() ).c_str() ) < 0
@ -554,7 +554,7 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter )
{
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
{
aPlotter->set_current_line_width( item->GetPenSize() );
aPlotter->SetCurrentLineWidth( item->GetPenSize() );
item->Plot( aPlotter );
}
}

View File

@ -1111,24 +1111,24 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
wxPoint pos_sheetname, pos_filename;
wxPoint pos;
aPlotter->set_color( ReturnLayerColor( GetLayer() ) );
aPlotter->SetColor( ReturnLayerColor( GetLayer() ) );
int thickness = GetPenSize();
aPlotter->set_current_line_width( thickness );
aPlotter->SetCurrentLineWidth( thickness );
aPlotter->move_to( m_pos );
aPlotter->MoveTo( m_pos );
pos = m_pos;
pos.x += m_size.x;
aPlotter->line_to( pos );
aPlotter->LineTo( pos );
pos.y += m_size.y;
aPlotter->line_to( pos );
aPlotter->LineTo( pos );
pos = m_pos;
pos.y += m_size.y;
aPlotter->line_to( pos );
aPlotter->finish_to( m_pos );
aPlotter->LineTo( pos );
aPlotter->FinishTo( m_pos );
if( IsVerticalOrientation() )
{
@ -1151,10 +1151,10 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
thickness = g_DrawDefaultLineThickness;
thickness = Clamp_Text_PenSize( thickness, size, false );
aPlotter->set_color( ReturnLayerColor( LAYER_SHEETNAME ) );
aPlotter->SetColor( ReturnLayerColor( LAYER_SHEETNAME ) );
bool italic = false;
aPlotter->text( pos_sheetname, txtcolor, Text, name_orientation, size,
aPlotter->Text( pos_sheetname, txtcolor, Text, name_orientation, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM,
thickness, italic, false );
@ -1164,13 +1164,13 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
thickness = g_DrawDefaultLineThickness;
thickness = Clamp_Text_PenSize( thickness, size, false );
aPlotter->set_color( ReturnLayerColor( LAYER_SHEETFILENAME ) );
aPlotter->SetColor( ReturnLayerColor( LAYER_SHEETFILENAME ) );
aPlotter->text( pos_filename, txtcolor, Text, name_orientation, size,
aPlotter->Text( pos_filename, txtcolor, Text, name_orientation, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP,
thickness, italic, false );
aPlotter->set_color( ReturnLayerColor( GetLayer() ) );
aPlotter->SetColor( ReturnLayerColor( GetLayer() ) );
/* Draw texts : SheetLabel */
for( size_t i = 0; i < m_pins.size(); i++ )

View File

@ -691,7 +691,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
wxPoint textpos = m_Pos + GetSchematicTextOffset();
int thickness = GetPenSize();
aPlotter->set_current_line_width( thickness );
aPlotter->SetCurrentLineWidth( thickness );
if( m_MultilineAllowed )
{
@ -706,7 +706,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
for( unsigned i = 0; i<list->Count(); i++ )
{
wxString txt = list->Item( i );
aPlotter->text( pos, color, txt, m_Orient, m_Size, m_HJustify,
aPlotter->Text( pos, color, txt, m_Orient, m_Size, m_HJustify,
m_VJustify, thickness, m_Italic, m_Bold );
pos += offset;
}
@ -715,14 +715,14 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
}
else
{
aPlotter->text( textpos, color, m_Text, m_Orient, m_Size, m_HJustify,
aPlotter->Text( textpos, color, m_Text, m_Orient, m_Size, m_HJustify,
m_VJustify, thickness, m_Italic, m_Bold );
}
/* Draw graphic symbol for global or hierarchical labels */
CreateGraphicShape( Poly, m_Pos );
aPlotter->set_current_line_width( GetPenSize() );
aPlotter->SetCurrentLineWidth( GetPenSize() );
if( Poly.size() )
aPlotter->PlotPoly( Poly, NO_FILL );

View File

@ -86,6 +86,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU( ID_GEN_PLOT_HPGL, SCH_EDIT_FRAME::ToPlot_HPGL )
EVT_MENU( ID_GEN_PLOT_SVG, SCH_EDIT_FRAME::SVG_Print )
EVT_MENU( ID_GEN_PLOT_DXF, SCH_EDIT_FRAME::ToPlot_DXF )
EVT_MENU( ID_GEN_PLOT_PDF, SCH_EDIT_FRAME::ToPlot_PDF )
EVT_MENU( ID_GEN_COPY_SHEET_TO_CLIPBOARD, EDA_DRAW_FRAME::CopyToClipboard )
EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit )
@ -215,11 +216,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
/* Get config */
LoadSettings();
// Initialize grid id to a default value if not found in config or bad:
if( (m_LastGridSizeId <= 0)
|| ( m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000) ) )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
// Initialize grid id to the default value (50 mils):
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
if( m_canvas )
@ -315,7 +313,7 @@ void SCH_EDIT_FRAME::SetSheetNumberAndCount()
for( screen = s_list.GetFirst(); screen != NULL; screen = s_list.GetNext() )
{
screen->m_NumberOfScreen = sheet_count;
screen->m_NumberOfScreens = sheet_count;
}
GetScreen()->m_ScreenNumber = SheetNumber;
@ -979,9 +977,8 @@ void SCH_EDIT_FRAME::UpdateTitle()
if( GetScreen()->GetFileName() == m_DefaultSchematicFileName )
{
wxString msg = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
title.Printf( wxT( "%s [%s]" ), GetChars( msg), GetChars( GetScreen()->GetFileName() ) );
SetTitle( title );
title.Printf( wxT( "Eeschema %s [%s]" ), GetChars( GetBuildVersion() ),
GetChars( GetScreen()->GetFileName() ) );
}
else
{
@ -991,12 +988,10 @@ void SCH_EDIT_FRAME::UpdateTitle()
// passed to LoadOneEEFile() which omits the path on non-root schematics.
// Making the path absolute solves this problem.
fn.MakeAbsolute();
title = wxChar( '[' );
title << fn.GetName() << wxChar( ' ' );
title << m_CurrentSheet->PathHumanReadable() << wxChar( ']' );
title << wxChar( ' ' );
title << wxChar( '(' ) << fn.GetPath() << wxChar( ')' );
title.Printf( wxT( "[ %s %s] (%s)" ),
GetChars( fn.GetName() ),
GetChars( m_CurrentSheet->PathHumanReadable() ),
GetChars( fn.GetPath() ) );
if( fn.FileExists() )
{
@ -1006,6 +1001,7 @@ void SCH_EDIT_FRAME::UpdateTitle()
else
title << _( " [no file]" );
SetTitle( title );
}
SetTitle( title );
}

View File

@ -130,6 +130,9 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
LoadSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
// Initialize grid id to the default value (50 mils):
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
ReCreateHToolbar();

View File

@ -1,4 +1,4 @@
add_definitions(-DGERBVIEW -DPCBNEW)
add_definitions(-DGERBVIEW)
###
# Includes
@ -22,10 +22,11 @@ set(DIALOGS_SRCS
dialogs/gerbview_dialog_display_options_frame_base.cpp
dialogs/gerbview_dialog_display_options_frame.cpp
dialogs/dialog_layers_select_to_pcb_base.cpp
dialogs/dialog_show_page_borders.cpp
dialogs/dialog_show_page_borders_base.cpp
dialogs/dialog_print_using_printer.cpp
dialogs/dialog_print_using_printer_base.cpp
dialogs/dialog_select_one_pcb_layer.cpp
dialogs/dialog_show_page_borders.cpp
dialogs/dialog_show_page_borders_base.cpp
)
set(GERBVIEW_SRCS
@ -34,9 +35,11 @@ set(GERBVIEW_SRCS
class_aperture_macro.cpp
class_DCodeSelectionbox.cpp
class_gbr_screen.cpp
class_gbr_layout.cpp
class_GERBER.cpp
class_gerber_draw_item.cpp
class_gerbview_layer_widget.cpp
class_gbr_layer_box_selector.cpp
controle.cpp
dcode.cpp
draw_gerber_screen.cpp
@ -53,7 +56,6 @@ set(GERBVIEW_SRCS
menubar.cpp
onleftclick.cpp
onrightclick.cpp
options.cpp
pcbplot.cpp
readgerb.cpp
rs274_read_XY_and_IJ_coordinates.cpp
@ -67,10 +69,12 @@ set(GERBVIEW_SRCS
# We need some extra sources from common and pcbnew
###
set(GERBVIEW_EXTRA_SRCS
../common/base_screen.cpp
../common/base_units.cpp
../common/class_layer_box_selector.cpp
../common/class_page_info.cpp
../pcbnew/layer_widget.cpp
../pcbnew/printout_controler.cpp
../pcbnew/class_drc_item.cpp
)
###
@ -117,7 +121,7 @@ endif(APPLE)
###
# Link executable target gerbview with correct libraries
###
target_link_libraries(gerbview pcbcommon common 3d-viewer polygon bitmaps kbool
target_link_libraries(gerbview common polygon bitmaps kbool
${OPENGL_LIBRARIES}
${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES})

View File

@ -91,27 +91,7 @@ void GERBVIEW_FRAME::HandleBlockPlace( wxDC* DC )
GetScreen()->m_BlockLocate.ClearItemsList();
break;
case BLOCK_COPY: /* Copy */
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
Block_Duplicate( DC );
GetScreen()->m_BlockLocate.ClearItemsList();
break;
case BLOCK_PASTE:
case BLOCK_DRAG:
case BLOCK_PRESELECT_MOVE:
case BLOCK_ZOOM:
case BLOCK_ROTATE:
case BLOCK_FLIP:
case BLOCK_DELETE:
case BLOCK_SAVE:
case BLOCK_ABORT:
case BLOCK_SELECT_ITEMS_ONLY:
case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y:
case BLOCK_IDLE:
default:
wxFAIL_MSG( wxT("HandleBlockPlace: Unexpected block command") );
break;
}
@ -136,7 +116,6 @@ bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC )
switch( GetScreen()->m_BlockLocate.GetCommand() )
{
case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
nextcmd = true;
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
@ -144,27 +123,11 @@ bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
break;
case BLOCK_DELETE: /* Delete */
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
Block_Delete( DC );
break;
case BLOCK_ZOOM: /* Window Zoom */
zoom_command = true;
break;
case BLOCK_PRESELECT_MOVE: /* Move with preselection list */
case BLOCK_DRAG:
case BLOCK_IDLE:
case BLOCK_MIRROR_X: /* Mirror, unused*/
case BLOCK_ROTATE: /* Unused */
case BLOCK_FLIP: /* Flip, unused */
case BLOCK_SAVE: /* Save (not used)*/
case BLOCK_PASTE:
case BLOCK_ABORT:
case BLOCK_SELECT_ITEMS_ONLY:
case BLOCK_MIRROR_Y:
default:
wxFAIL_MSG( wxT("HandleBlockEnd: Unexpected block command") );
break;
}
@ -228,31 +191,6 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
}
void GERBVIEW_FRAME::Block_Delete( wxDC* DC )
{
if( !IsOK( this, _( "Ok to delete block ?" ) ) )
return;
GetScreen()->SetModify();
GetScreen()->m_BlockLocate.Normalize();
GetScreen()->SetCurItem( NULL );
BOARD_ITEM* item = GetBoard()->m_Drawings;
BOARD_ITEM* nextitem;
for( ; item; item = nextitem )
{
nextitem = item->Next();
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->HitTest( GetScreen()->m_BlockLocate ) )
gerb_item->DeleteStructure();
}
Refresh();
}
void GERBVIEW_FRAME::Block_Move( wxDC* DC )
{
wxPoint delta;
@ -270,9 +208,7 @@ void GERBVIEW_FRAME::Block_Move( wxDC* DC )
delta = GetScreen()->m_BlockLocate.GetMoveVector();
/* Move items in block */
BOARD_ITEM* item = GetBoard()->m_Drawings;
for( ; item; item = item->Next() )
for( GERBER_DRAW_ITEM* item = GetItemsList(); item; item = item->Next() )
{
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
@ -282,38 +218,3 @@ void GERBVIEW_FRAME::Block_Move( wxDC* DC )
m_canvas->Refresh( true );
}
void GERBVIEW_FRAME::Block_Duplicate( wxDC* DC )
{
wxPoint delta;
wxPoint oldpos;
oldpos = GetScreen()->GetCrossHairPosition();
m_canvas->SetMouseCaptureCallback( NULL );
GetScreen()->SetCrossHairPosition( oldpos );
m_canvas->MoveCursorToCrossHair();
GetScreen()->SetModify();
GetScreen()->m_BlockLocate.Normalize();
delta = GetScreen()->m_BlockLocate.GetMoveVector();
/* Copy items in block */
BOARD_ITEM* item = GetBoard()->m_Drawings;
for( ; item; item = item->Next() )
{
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->HitTest( GetScreen()->m_BlockLocate ) )
{
/* this item must be duplicated */
GERBER_DRAW_ITEM* new_item = gerb_item->Copy();
new_item->MoveAB( delta );
GetBoard()->m_Drawings.PushFront( new_item );
}
}
m_canvas->Refresh();
}

View File

@ -95,8 +95,6 @@ GERBER_IMAGE::GERBER_IMAGE( GERBVIEW_FRAME* aParent, int aLayer )
for( unsigned ii = 0; ii < DIM( m_Aperture_List ); ii++ )
m_Aperture_List[ii] = 0;
m_Pcb = aParent->GetBoard();
}
@ -108,10 +106,16 @@ GERBER_IMAGE::~GERBER_IMAGE()
// m_Aperture_List[ii] = NULL;
}
delete m_Pcb;
}
/*
* Function GetItemsList
* returns the first GERBER_DRAW_ITEM * item of the items list
*/
GERBER_DRAW_ITEM * GERBER_IMAGE::GetItemsList()
{
return m_Parent->GetItemsList();
}
D_CODE* GERBER_IMAGE::GetDCODE( int aDCODE, bool create )
{
@ -206,18 +210,16 @@ bool GERBER_IMAGE::HasNegativeItems()
else
{
m_hasNegativeItems = 0;
for( BOARD_ITEM* item = m_Pcb->m_Drawings; item; item = item->Next() )
for( GERBER_DRAW_ITEM* item = GetItemsList(); item; item = item->Next() )
{
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->GetLayer() != m_GraphicLayer )
if( item->GetLayer() != m_GraphicLayer )
continue;
if( gerb_item->HasNegativeItems() )
if( item->HasNegativeItems() )
{
m_hasNegativeItems = 1;
break;
}
}
// TODO search for items in list
}
}
return m_hasNegativeItems == 1;
@ -306,7 +308,7 @@ void GERBER_IMAGE::StepAndRepeatItem( const GERBER_DRAW_ITEM& aItem )
move_vector.y = scaletoIU( jj * GetLayerParams().m_StepForRepeat.y,
GetLayerParams().m_StepForRepeatMetric );
dupItem->MoveXY( move_vector );
m_Parent->GetBoard()->m_Drawings.Append( dupItem );
m_Parent->GetLayout()->m_Drawings.Append( dupItem );
}
}
}

View File

@ -17,7 +17,6 @@
|| ( (x) == '-' ) || ( (x) == '+' ) || ( (x) == '.' ) )
class GERBVIEW_FRAME;
class BOARD;
class D_CODE;
/* gerber files have different parameters to define units and how items must be plotted.
@ -74,10 +73,9 @@ private:
*/
class GERBER_IMAGE
{
GERBVIEW_FRAME* m_Parent; // the parent GERBVIEW_FRAME (used to display messages...)
GERBVIEW_FRAME* m_Parent; // the parent GERBVIEW_FRAME (used to display messages...)
D_CODE* m_Aperture_List[TOOLS_MAX_COUNT]; ///< Dcode (Aperture) List for this layer (max 999)
bool m_Exposure; ///< whether an aperture macro tool is flashed on or off
BOARD* m_Pcb;
GERBER_LAYER m_GBRLayerParams; // hold params for the current gerber layer
@ -155,6 +153,12 @@ public:
return m_Parent;
}
/**
* Function GetItemsList
* @return the first GERBER_DRAW_ITEM * item of the items list
*/
GERBER_DRAW_ITEM * GetItemsList();
/**
* Function GetLayerParams
* @return the current layers params

View File

@ -53,7 +53,7 @@ enum drill_G_code_t {
// Helper struct to analyse Excellon commands
struct EXCELLON_CMD
{
string m_Name; // key string
std::string m_Name; // key string
int m_Code; // internal code, used as id in functions
int m_asParams; // 0 = no param, -1 = skip params, 1 = read params
};

View File

@ -0,0 +1,80 @@
/**
* @file class_gbr_layer_box_selector.cpp
* @brief a derived class of LAYER_BOX_SELECTOR to handle the layer box selector
* in GerbView
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-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.
*
* 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 <common.h>
#include <colors_selection.h>
#include <layers_id_colors_and_visibility.h>
#include <gerbview_frame.h>
#include <wx/ownerdrw.h>
#include <wx/menuitem.h>
#include <wx/bmpcbox.h>
#include <wx/wx.h>
#include <class_gbr_layer_box_selector.h>
void GBR_LAYER_BOX_SELECTOR::Resync()
{
Clear();
for( int layerid = 0; layerid < LAYER_COUNT; layerid++ )
{
wxBitmap layerbmp( 14, 14 );
wxString layername;
if( !IsLayerEnabled( layerid ) )
continue;
// Prepare Bitmap
SetBitmapLayer( layerbmp, layerid );
layername = GetLayerName( layerid );
Append( layername, layerbmp, (void*) layerid );
}
}
// Returns a color index from the layer id
int GBR_LAYER_BOX_SELECTOR::GetLayerColor( int aLayerIndex )
{
GERBVIEW_FRAME* frame = (GERBVIEW_FRAME*) GetParent()->GetParent();
return frame->GetLayerColor( aLayerIndex );
}
// Returns the name of the layer id
const wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( int aLayerIndex )
{
wxString name;
name.Printf( _( "Layer %d" ), aLayerIndex + 1 );
return name;
}

View File

@ -0,0 +1,51 @@
#ifndef CLASS_GBR_LAYER_BOX_SELECTOR_H
#define CLASS_GBR_LAYER_BOX_SELECTOR_H 1
#include <class_layer_box_selector.h>
/* class to display a layer list in GerbView.
*
*/
class GBR_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR
{
public:
GBR_LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL )
:LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
{
m_layerhotkeys = false;
m_layerorder = false;
}
GBR_LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices )
:LAYER_BOX_SELECTOR( parent, id, pos, size, choices )
{
m_layerhotkeys = false;
m_layerorder = false;
}
// Reload the Layers names and bitmaps
// Virtual function
void Resync();
// Returns a color index from the layer id
// Virtual function
int GetLayerColor( int aLayerIndex );
// Returns true if the layer id is enabled (i.e. is it should be displayed)
// Virtual function
bool IsLayerEnabled( int aLayerIndex ) { return true; };
// Returns the name of the layer id
// Virtual function
const wxString GetLayerName( int aLayerIndex );
};
#endif //CLASS_GBR_LAYER_BOX_SELECTOR_H

View File

@ -0,0 +1,45 @@
/**
* @file class_gbr_layout.cpp
* @brief GBR_LAYOUT class functions.
*/
#include <limits.h>
#include <algorithm>
#include <fctsys.h>
#include <common.h>
#include <class_gbr_layout.h>
GBR_LAYOUT::GBR_LAYOUT()
{
PAGE_INFO pageInfo( wxT( "GERBER" ) );
SetPageSettings( pageInfo );
m_printLayersMask = -1;
}
GBR_LAYOUT::~GBR_LAYOUT()
{
}
/* Function IsLayerVisible
* tests whether a given layer is visible
* param aLayerIndex = The index of the layer to be tested
* return bool - true if the layer is visible.
*/
bool GBR_LAYOUT::IsLayerVisible( int aLayerIndex ) const
{
return m_printLayersMask & (1 << aLayerIndex );
}
EDA_RECT GBR_LAYOUT::ComputeBoundingBox()
{
EDA_RECT bbox;
for( GERBER_DRAW_ITEM* gerb_item = m_Drawings; gerb_item; gerb_item = gerb_item->Next() )
bbox.Merge( gerb_item->GetBoundingBox() );
SetBoundingBox( bbox );
return bbox;
}

112
gerbview/class_gbr_layout.h Normal file
View File

@ -0,0 +1,112 @@
/**
* @file class_gbr_layout.h
* @brief Class CLASS_GBR_LAYOUT to handle a board.
*/
#ifndef CLASS_GBR_LAYOUT_H
#define CLASS_GBR_LAYOUT_H
#include <dlist.h>
// #include <layers_id_colors_and_visibility.h>
#include <class_colors_design_settings.h>
#include <common.h> // PAGE_INFO
#include <class_title_block.h>
#include <class_gerber_draw_item.h>
/**
* Class GBR_LAYOUT
* holds list of GERBER_DRAW_ITEM currently loaded.
*/
class GBR_LAYOUT
{
private:
EDA_RECT m_BoundingBox;
PAGE_INFO m_paper;
TITLE_BLOCK m_titles;
wxPoint m_originAxisPosition;
int m_printLayersMask; // When printing: the list of layers to print
public:
DLIST<GERBER_DRAW_ITEM> m_Drawings; // linked list of Gerber Items
GBR_LAYOUT();
~GBR_LAYOUT();
const PAGE_INFO& GetPageSettings() const { return m_paper; }
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
const wxPoint& GetOriginAxisPosition() const
{
return m_originAxisPosition;
}
void SetOriginAxisPosition( const wxPoint& aPosition )
{
m_originAxisPosition = aPosition;
}
TITLE_BLOCK& GetTitleBlock()
{
return m_titles;
}
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
{
m_titles = aTitleBlock;
}
/**
* Function ComputeBoundingBox
* calculates the bounding box containing all Gerber items.
* @return EDA_RECT - the full item list bounding box
*/
EDA_RECT ComputeBoundingBox();
/**
* Function GetBoundingBox
* may be called soon after ComputeBoundingBox() to return the same EDA_RECT,
* as long as the CLASS_GBR_LAYOUT has not changed.
*/
EDA_RECT GetBoundingBox() const { return m_BoundingBox; } // override
void SetBoundingBox( const EDA_RECT& aBox ) { m_BoundingBox = aBox; }
/**
* Function Draw.
* Redraw the CLASS_GBR_LAYOUT items but not cursors, axis or grid.
* @param aPanel = the panel relative to the board
* @param aDC = the current device context
* @param aDrawMode = GR_COPY, GR_OR ... (not always used)
* @param aOffset = an draw offset value
*/
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
int aDrawMode, const wxPoint& aOffset );
/**
* Function SetVisibleLayers
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void SetVisibleLayers( int aLayerMask )
{
m_printLayersMask = aLayerMask;
}
/**
* Function IsLayerVisible
* tests whether a given layer is visible
* @param aLayerIndex = The index of the layer to be tested
* @return bool - true if the layer is visible.
*/
bool IsLayerVisible( int aLayerIndex ) const;
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // overload
#endif
};
#endif // #ifndef CLASS_GBR_LAYOUT_H

View File

@ -1,7 +1,5 @@
/**
* @file classpcb.cpp
* @brief Member functions of classes used in Pcbnew (see pcbstruct.h)
* except for tracks (see class_track.cpp).
* @file class_gbr_screen.cpp
*/
#include <fctsys.h>
@ -24,14 +22,9 @@
/**
Default Pcbnew zoom values.
Default GerbView zoom values.
Limited to 19 values to keep a decent size to menus.
Roughly a 1.5 progression.
The last 2 values are handy when somebody uses a library import of a module
(or foreign data) which has a bad coordinate.
Also useful in GerbView for this reason.
Zoom 5 and 10 can create artefacts when drawing (integer overflow in low level graphic
functions )
*/
static const double gbrZoomList[] =
{
@ -89,29 +82,28 @@ static GRID_TYPE gbrGridList[] =
GBR_SCREEN::GBR_SCREEN( const wxSize& aPageSizeIU ) :
PCB_SCREEN( aPageSizeIU )
BASE_SCREEN( SCREEN_T )
{
// Replace zoom and grid lists already set by PCB_SCREEN ctor
m_ZoomList.Clear();
for( unsigned i = 0; i < DIM( gbrZoomList ); ++i )
m_ZoomList.Add( gbrZoomList[i] );
m_ZoomList.push_back( gbrZoomList[i] );
GRIDS gridlist;
for( unsigned i = 0; i < DIM( gbrGridList ); ++i )
gridlist.push_back( gbrGridList[i] );
SetGridList( gridlist );
AddGrid( gbrGridList[i] );
// Set the working grid size to a reasonnable value (in 1/10000 inch)
// Set the working grid size to a reasonable value (in 1/10000 inch)
SetGrid( DMIL_GRID( 500 ) );
m_Active_Layer = LAYER_N_BACK; // default active layer = bottom layer
SetZoom( ZOOM_FACTOR( 350 ) ); // a default value for zoom
InitDataPoints( aPageSizeIU );
}
GBR_SCREEN::~GBR_SCREEN()
{
ClearUndoRedoList();
}
@ -120,3 +112,13 @@ int GBR_SCREEN::MilsToIuScalar()
{
return (int)IU_PER_MILS;
}
/* Virtual function needed by classes derived from BASE_SCREEN
* this is a virtual pure function in BASE_SCREEN
* do nothing in GerbView
* could be removed later
*/
void GBR_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER&, int )
{
}

View File

@ -7,16 +7,16 @@
#include <base_units.h>
#include <class_pcb_screen.h>
#include <class_base_screen.h>
#define ZOOM_FACTOR( x ) ( x * IU_PER_DECIMILS )
/* Handle info to display a board */
class GBR_SCREEN : public PCB_SCREEN
class GBR_SCREEN : public BASE_SCREEN
{
public:
int m_Active_Layer;
/**
* Constructor
* @param aPageSizeIU is the size of the initial paper page in internal units.
@ -27,7 +27,18 @@ public:
GBR_SCREEN* Next() { return (GBR_SCREEN*) Pnext; }
// void SetNextZoom();
// void SetPreviousZoom();
// void SetLastZoom();
virtual int MilsToIuScalar();
/**
* Function ClearUndoORRedoList
* virtual pure in BASE_SCREEN, so it must be defined here
*/
void ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount = -1 );
};
#endif // CLASS_GBR_SCREEN_H_

View File

@ -32,18 +32,15 @@
#include <common.h>
#include <trigo.h>
#include <class_drawpanel.h>
#include <drawtxt.h>
#include <macros.h>
#include <gerbview.h>
#include <class_board_design_settings.h>
#include <colors_selection.h>
#include <class_gerber_draw_item.h>
#include <class_GERBER.h>
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( BOARD_ITEM* aParent, GERBER_IMAGE* aGerberparams ) :
BOARD_ITEM( aParent, TYPE_GERBER_DRAW_ITEM )
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GBR_LAYOUT* aParent, GERBER_IMAGE* aGerberparams ) :
EDA_ITEM( (EDA_ITEM*)aParent, TYPE_GERBER_DRAW_ITEM )
{
m_imageParams = aGerberparams;
m_Layer = 0;
@ -64,7 +61,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( BOARD_ITEM* aParent, GERBER_IMAGE* aGerberpa
// Copy constructor
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ) :
BOARD_ITEM( aSource )
EDA_ITEM( aSource )
{
m_imageParams = aSource.m_imageParams;
m_Shape = aSource.m_Shape;
@ -316,16 +313,16 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode,
int radius;
int halfPenWidth;
static bool show_err;
BOARD* brd = GetBoard();
D_CODE* d_codeDescr = GetDcodeDescr();
GERBVIEW_FRAME* gerbFrame = (GERBVIEW_FRAME*) aPanel->GetParent();
if( d_codeDescr == NULL )
d_codeDescr = &dummyD_CODE;
if( brd->IsLayerVisible( GetLayer() ) == false )
if( gerbFrame->IsLayerVisible( GetLayer() ) == false )
return;
color = brd->GetLayerColor( GetLayer() );
color = gerbFrame->GetLayerColor( GetLayer() );
if( aDrawMode & GR_HIGHLIGHT )
{
@ -354,12 +351,12 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode,
GRSetDrawMode( aDC, aDrawMode );
isFilled = DisplayOpt.DisplayPcbTrackFill ? true : false;
isFilled = gerbFrame->m_DisplayOptions.m_DisplayLinesFill;
switch( m_Shape )
{
case GBR_POLYGON:
isFilled = (g_DisplayPolygonsModeSketch == false);
isFilled = gerbFrame->m_DisplayOptions.m_DisplayPolygonsFill;
if( !isDark )
isFilled = true;
@ -419,7 +416,7 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode,
case GBR_SPOT_OVAL:
case GBR_SPOT_POLY:
case GBR_SPOT_MACRO:
isFilled = DisplayOpt.DisplayPadFill ? true : false;
isFilled = gerbFrame->m_DisplayOptions.m_DisplayFlashedItemsFill;
d_codeDescr->DrawFlashedShape( this, aPanel->GetClipBox(), aDC, color, alt_color,
m_Start, isFilled );
break;

View File

@ -30,10 +30,12 @@
#define CLASS_GERBER_DRAW_ITEM_H
#include <base_struct.h>
#include <class_board_item.h>
#include <dlist.h>
class GERBER_IMAGE;
class GBR_LAYOUT;
class D_CODE;
/* Shapes id for basic shapes ( .m_Shape member ) */
@ -52,7 +54,7 @@ enum Gbr_Basic_Shapes {
/***/
class GERBER_DRAW_ITEM : public BOARD_ITEM
class GERBER_DRAW_ITEM : public EDA_ITEM
{
// make SetNext() and SetBack() private so that they may not be called from anywhere.
// list management is done on GERBER_DRAW_ITEMs using DLIST<GERBER_DRAW_ITEM> only.
@ -86,6 +88,8 @@ public:
* redundancy for these parameters
*/
private:
int m_Layer;
// These values are used to draw this item, according to gerber layers parameters
// Because they can change inside a gerber image, they are stored here
// for each item
@ -98,7 +102,7 @@ private:
double m_lyrRotation; // Fine rotation, from OR parameter, in degrees
public:
GERBER_DRAW_ITEM( BOARD_ITEM* aParent, GERBER_IMAGE* aGerberparams );
GERBER_DRAW_ITEM( GBR_LAYOUT* aParent, GERBER_IMAGE* aGerberparams );
GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource );
~GERBER_DRAW_ITEM();
@ -113,6 +117,21 @@ public:
GERBER_DRAW_ITEM* Next() const { return (GERBER_DRAW_ITEM*) Pnext; }
GERBER_DRAW_ITEM* Back() const { return (GERBER_DRAW_ITEM*) Pback; }
/**
* Function GetLayer
* returns the layer this item is on.
*/
int GetLayer() const { return m_Layer; }
/**
* Function SetLayer
* sets the layer this item is on.
* @param aLayer The layer number.
* is virtual because some items (in fact: class DIMENSION)
* have a slightly different initialization
*/
void SetLayer( int aLayer ) { m_Layer = aLayer; }
int ReturnMaskLayer()
{
return 1 << m_Layer;
@ -203,7 +222,7 @@ public:
void Draw( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
int aDrawMode,
const wxPoint&aOffset = ZeroOffset );
const wxPoint&aOffset );
/**
* Function ConvertSegmentToPolygon
@ -270,6 +289,28 @@ public:
*/
bool Save( FILE* aFile ) const;
/**
* Function UnLink
* detaches this object from its owner.
*/
void UnLink()
{
DLIST<GERBER_DRAW_ITEM>* list = (DLIST<GERBER_DRAW_ITEM>*) GetList();
wxASSERT( list );
if( list )
list->Remove( this );
}
/**
* Function DeleteStructure
* deletes this object after UnLink()ing it from its owner.
*/
void DeleteStructure()
{
UnLink();
delete this;
}
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override
#endif

View File

@ -34,7 +34,7 @@
#include <class_drawpanel.h>
#include <pcbstruct.h>
#include <macros.h>
#include <class_layer_box_selector.h>
#include <class_gbr_layer_box_selector.h>
#include <gerbview.h>
#include <class_GERBER.h>
@ -91,7 +91,6 @@ void GERBER_LAYER_WIDGET::SetLayersManagerTabsText( )
*/
void GERBER_LAYER_WIDGET::ReFillRender()
{
BOARD* board = myframe->GetBoard();
ClearRenderRows();
// Fixed "Rendering" tab rows within the LAYER_WIDGET, only the initial color
@ -111,10 +110,9 @@ void GERBER_LAYER_WIDGET::ReFillRender()
{
if( renderRows[row].color != -1 ) // does this row show a color?
{
// this window frame must have an established BOARD, i.e. after SetBoard()
renderRows[row].color = board->GetVisibleElementColor( renderRows[row].id );
renderRows[row].color = myframe->GetVisibleElementColor( renderRows[row].id );
}
renderRows[row].state = board->IsElementVisible( renderRows[row].id );
renderRows[row].state = myframe->IsElementVisible( renderRows[row].id );
}
AppendRenderRows( renderRows, DIM(renderRows) );
@ -184,7 +182,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
visibleLayers &= ~(1 << row);
}
myframe->GetBoard()->SetVisibleLayers( visibleLayers );
myframe->SetVisibleLayers( visibleLayers );
myframe->GetCanvas()->Refresh();
break;
}
@ -194,16 +192,15 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
void GERBER_LAYER_WIDGET::ReFill()
{
BOARD* brd = myframe->GetBoard();
int layer;
ClearLayerRows();
for( layer = 0; layer < LAYER_COUNT; layer++ )
for( layer = 0; layer < GERBVIEW_LAYER_COUNT; layer++ )
{
wxString msg;
msg.Printf( _("Layer %d"), layer+1 );
AppendLayerRow( LAYER_WIDGET::ROW( msg, layer,
brd->GetLayerColor( layer ), wxEmptyString, true ) );
myframe->GetLayerColor( layer ), wxEmptyString, true ) );
}
installRightLayerClickHandler();
@ -213,7 +210,7 @@ void GERBER_LAYER_WIDGET::ReFill()
void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, int aColor )
{
myframe->GetBoard()->SetLayerColor( aLayer, aColor );
myframe->SetLayerColor( aLayer, aColor );
myframe->m_SelLayerBox->ResyncBitmapOnly();
myframe->GetCanvas()->Refresh();
}
@ -234,15 +231,14 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer )
void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
{
BOARD* brd = myframe->GetBoard();
int visibleLayers = brd->GetVisibleLayers();
int visibleLayers = myframe->GetVisibleLayers();
if( isVisible )
visibleLayers |= (1 << aLayer);
else
visibleLayers &= ~(1 << aLayer);
brd->SetVisibleLayers( visibleLayers );
myframe->SetVisibleLayers( visibleLayers );
if( isFinal )
myframe->GetCanvas()->Refresh();
@ -250,15 +246,13 @@ void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFin
void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, int aColor )
{
myframe->GetBoard()->SetVisibleElementColor( aId, aColor );
myframe->SetVisibleElementColor( aId, aColor );
myframe->GetCanvas()->Refresh();
}
void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
{
BOARD* brd = myframe->GetBoard();
brd->SetElementVisibility( aId, isEnabled );
myframe->SetElementVisibility( aId, isEnabled );
myframe->GetCanvas()->Refresh();
}

View File

@ -104,7 +104,7 @@ void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
if( aHotKey )
{
OnHotKey( aDC, aHotKey, NULL );
OnHotKey( aDC, aHotKey, aPosition );
}
UpdateStatusBar();

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