KiCad PCB EDA Suite
page_layout_default_description.cpp
Go to the documentation of this file.
1 
5 /*
6  * This program source code file is part of KiCad, a free EDA CAD application.
7  *
8  * Copyright (C) 1992-2013 Jean-Pierre Charras <jp.charras at wanadoo.fr>.
9  * Copyright (C) 1992-2013 KiCad Developers, see change_log.txt for contributors.
10  *
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, you may find one here:
24  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
25  * or you may search the http://www.gnu.org website for the version 2 license,
26  * or you may write to the Free Software Foundation, Inc.,
27  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
28  */
29 
30 /* keyword used in page layout description are listed
31  * in page_layout_reader.keywords file
32  */
33 
34 /*
35  * Items use coordinates.
36  * A coordinate is defined relative to a page corner
37  * A coordinate is the X pos, the Y pos, and the corner which is the coordinate origin
38  * the default is the bottom right corner
39  * example: (start 10 0 ltcorner) or (start 20 10)
40  * The direction depends on the corner: a positive coordinate define a point
41  * from the corner origin, to the opposite corner.
42  *
43  * Items are defined by a name, coordinates in mm and some attributes,
44  * and can be repeated.
45  * for instance (repeat 2) (incrx 2) (incry 2) repeat the item 2 times,
46  * and coordinates are incremented by 2 on X direction, and 2 on Y direction
47  * Comments are allowed. they are inside (), and start by the keyword comment
48  * example:
49  * (comment rect around the title block)
50  *
51  * Lines and rect are defined by 2 coordinates start and end, and attributes.
52  * Attributes are linewidth and repeat parameters.
53  * example:
54  * (line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )
55  * (rect (comment rect around the title block) (linewidth 0.15) (start 110 34) (end 2 2) )
56  *
57  * Texts are defined by the text (between quotes), the position, and attributes
58  * example
59  * "(tbtext \"1\" (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) )"
60  * the text can be rotated by (rotation <value>) with value = rot angle in degrees
61  * (font (size 1.3 1.3) bold italic) defines a specific size,
62  * with bold and italic options
63  * (justify <justif keyword>) controls the text justification (the default is left)
64  * justif keyword is center, left, right, top and bottom
65  * (justify center top) is a text centered on X axis and top aligned on vertical axis
66  * The text size can be constrained:
67  * (maxlen <value>) and (maxheight <value>) force the actual text x and/or y size to be
68  * reduced to limit the text height to the maxheight value,
69  * and the full text x size to the maxlen value.
70  * If the actual text size is smaller than limits, its size is not modified.
71  *
72  * Texts can include a format symbol, a la printf.
73  * At run time these format symbols will be replaced by their actual value.
74  *
75  * format symbols are:
76  *
77  * %% = replaced by %
78  * %K = Kicad version
79  * %Z = paper format name (A4, USLetter ...)
80  * %Y = company name
81  * %D = date
82  * %R = revision
83  * %S = sheet number
84  * %N = number of sheets
85  * %Cx = comment (x = 0 to 9 to identify the comment)
86  * %F = filename
87  * %P = sheet path (sheet full name)
88  * %T = title
89  *
90  * example:
91  * (tbtext \"Size: %Z\" ...) displays "Size A4" or Size USLetter"
92  *
93  * Poly Polygons
94  * Set of filled polygons are supported.
95  *
96  * The main purpose is to allow logos, or complex shapes
97  * They support the repeat and rotation options
98  * They are defined by
99  * (polygon (position ..) <rotation> <linewidth>
100  * the parameter linewidth defines the pen size used to draw/plot
101  * the polygon outlines (default = 0)
102  * example:
103  * (polygon (pos 134 18 rbcorner) (rotate 20) (linewidth 0.00254)
104  *
105  * and a list of corners like
106  * (pts (xy 20.574 8.382) (xy 19.9009 8.382) (xy 19.9009 6.26364) (xy 19.7485 5.98932)
107  * .... )
108  *
109  * each sequence like
110  * (pts (xy 20.574 8.382) (xy 19.9009 8.382) (xy 19.9009 6.26364) (xy 19.7485 5.98932)
111  * .... )
112  * defines a polygon.
113  * Each coordinate is relative to the polygon position.
114  * Therefore a "polygon" is in fact a set of polygons, of a poly polygon
115  *
116  */
117 
118 #include <worksheet.h> // defaultPageLayout
119 
120 
121 // height of the band reference grid 2.0 mm
122 // worksheet frame reference text size 1.3 mm
123 // default text size 1.5 mm
124 // default line width 0.15 mm
125 // frame ref pitch 50 mm
126 
127 // export defaultPageLayout:
128 extern const char defaultPageLayout[];
129 
130 // Default page layout (sizes are in mm)
131 const char defaultPageLayout[] = "( page_layout\n"
132  "(setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15)\n"
133  "(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))\n"
134  "(rect (comment \"rect around the title block\") (linewidth 0.15) (start 110 34) (end 2 2) )\n"
135  "(rect (start 0 0 ltcorner) (end 0 0 rbcorner) (repeat 2) (incrx 2) (incry 2) )\n"
136  "(line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )\n"
137  "(tbtext \"1\" (pos 25 1 ltcorner) (font (size 1.3 1.3))(repeat 100) (incrx 50) )\n"
138  "(line (start 50 2 lbcorner) (end 50 0 lbcorner) (repeat 30) (incrx 50) )\n"
139  "(tbtext \"1\" (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) )\n"
140  "(line (start 0 50 ltcorner) (end 2 50 ltcorner) (repeat 30) (incry 50) )\n"
141  "(tbtext \"A\" (pos 1 25 ltcorner) (font (size 1.3 1.3)) (justify center)(repeat 100) (incry 50) )\n"
142  "(line (start 0 50 rtcorner) (end 2 50 rtcorner) (repeat 30) (incry 50) )\n"
143  "(tbtext \"A\" (pos 1 25 rtcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50) )\n"
144  "(tbtext \"Date: %D\" (pos 87 6.9) )\n"
145  "(line (start 110 5.5) (end 2 5.5) )\n"
146  "(tbtext \"%K\" (pos 109 4.1) (comment \"Kicad version\" ) )\n"
147  "(line (start 110 8.5) (end 2 8.5) )\n"
148  "(tbtext \"Rev: %R\" (pos 24 6.9)(font bold)(justify left) )\n"
149  "(tbtext \"Size: %Z\" (comment \"Paper format name\")(pos 109 6.9) )\n"
150  "(tbtext \"Id: %S/%N\" (comment \"Sheet id\")(pos 24 4.1) )\n"
151  "(line (start 110 12.5) (end 2 12.5) )\n"
152  "(tbtext \"Title: %T\" (pos 109 10.7)(font bold italic (size 2 2)) )\n"
153  "(tbtext \"File: %F\" (pos 109 14.3) )\n"
154  "(line (start 110 18.5) (end 2 18.5) )\n"
155  "(tbtext \"Sheet: %P\" (pos 109 17) )\n"
156  "(tbtext \"%Y\" (comment \"Company name\") (pos 109 20)(font bold) )\n"
157  "(tbtext \"%C0\" (comment \"Comment 0\") (pos 109 23) )\n"
158  "(tbtext \"%C1\" (comment \"Comment 1\") (pos 109 26) )\n"
159  "(tbtext \"%C2\" (comment \"Comment 2\") (pos 109 29) )\n"
160  "(tbtext \"%C3\" (comment \"Comment 3\") (pos 109 32) )\n"
161  "(line (start 90 8.5) (end 90 5.5) )\n"
162  "(line (start 26 8.5) (end 26 2) )\n"
163  ")\n"
164 ;
const char defaultPageLayout[]