KiCad PCB EDA Suite
page_layout_reader.cpp
Go to the documentation of this file.
1 
7 /*
8  * This program source code file is part of KiCad, a free EDA CAD application.
9  *
10  * Copyright (C) 1992-2013 Jean-Pierre Charras <jp.charras at wanadoo.fr>.
11  * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
12  *
13  *
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, you may find one here:
26  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
27  * or you may search the http://www.gnu.org website for the version 2 license,
28  * or you may write to the Free Software Foundation, Inc.,
29  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
30  */
31 
32 #include <fctsys.h>
33 #include <base_struct.h>
34 #include <ws_painter.h>
35 #include <ws_draw_item.h>
36 #include <ws_data_model.h>
37 #include <page_layout/page_layout_reader_lexer.h>
38 
39 #include <wx/file.h>
40 #include <wx/mstream.h>
41 
42 
43 using namespace TB_READER_T;
44 
50 class PAGE_LAYOUT_READER_PARSER : public PAGE_LAYOUT_READER_LEXER
51 {
52 public:
53  PAGE_LAYOUT_READER_PARSER( const char* aLine, const wxString& aSource );
54  void Parse( WS_DATA_MODEL* aLayout );
55 
56 private:
57 
65  int parseInt( int aMin, int aMax );
66 
72  double parseDouble();
73 
74  void parseSetup( WS_DATA_MODEL* aLayout );
75 
79  void parseGraphic( WS_DATA_ITEM * aItem );
80 
84  void parseText( WS_DATA_ITEM_TEXT * aItem );
85 
90  void parsePolygon( WS_DATA_ITEM_POLYGONS * aItem );
91 
95  void parsePolyOutline( WS_DATA_ITEM_POLYGONS * aItem );
96 
97 
101  void parseBitmap( WS_DATA_ITEM_BITMAP * aItem );
102 
103  void parseCoordinate( POINT_COORD& aCoord);
104  void readOption( WS_DATA_ITEM * aItem );
105  void readPngdata( WS_DATA_ITEM_BITMAP * aItem );
106 };
107 
108 // PCB_PLOT_PARAMS_PARSER
109 
110 PAGE_LAYOUT_READER_PARSER::PAGE_LAYOUT_READER_PARSER( const char* aLine, const wxString& aSource ) :
111  PAGE_LAYOUT_READER_LEXER( aLine, aSource )
112 {
113 }
114 
115 
116 wxString convertLegacyVariableRefs( const wxString& aTextbase )
117 {
118  wxString msg;
119 
120  /*
121  * Legacy formats
122  * %% = replaced by %
123  * %K = Kicad version
124  * %Z = paper format name (A4, USLetter)
125  * %Y = company name
126  * %D = date
127  * %R = revision
128  * %S = sheet number
129  * %N = number of sheets
130  * %L = layer name
131  * %Cx = comment (x = 0 to 9 to identify the comment)
132  * %F = filename
133  * %P = sheet path (sheet full name)
134  * %T = title
135  */
136 
137  for( unsigned ii = 0; ii < aTextbase.Len(); ii++ )
138  {
139  if( aTextbase[ii] != '%' )
140  {
141  msg << aTextbase[ii];
142  continue;
143  }
144 
145  if( ++ii >= aTextbase.Len() )
146  break;
147 
148  wxChar format = aTextbase[ii];
149 
150  switch( format )
151  {
152  case '%': msg += '%'; break;
153  case 'D': msg += wxT( "${ISSUE_DATE}" ); break;
154  case 'R': msg += wxT( "${REVISION}" ); break;
155  case 'K': msg += wxT( "${KICAD_VERSION}" ); break;
156  case 'Z': msg += wxT( "${PAPER}" ); break;
157  case 'S': msg += wxT( "${#}" ); break;
158  case 'N': msg += wxT( "${##}" ); break;
159  case 'F': msg += wxT( "${FILENAME}" ); break;
160  case 'L': msg += wxT( "${LAYER}" ); break;
161  case 'P': msg += wxT( "${SHEETNAME}" ); break;
162  case 'Y': msg += wxT( "${COMPANY}" ); break;
163  case 'T': msg += wxT( "${TITLE}" ); break;
164  case 'C':
165  format = aTextbase[++ii];
166 
167  switch( format )
168  {
169  case '0': msg += wxT( "${COMMENT0}" ); break;
170  case '1': msg += wxT( "${COMMENT1}" ); break;
171  case '2': msg += wxT( "${COMMENT2}" ); break;
172  case '3': msg += wxT( "${COMMENT3}" ); break;
173  case '4': msg += wxT( "${COMMENT4}" ); break;
174  case '5': msg += wxT( "${COMMENT5}" ); break;
175  case '6': msg += wxT( "${COMMENT6}" ); break;
176  case '7': msg += wxT( "${COMMENT7}" ); break;
177  case '8': msg += wxT( "${COMMENT8}" ); break;
178  case '9': msg += wxT( "${COMMENT9}" ); break;
179  }
180  break;
181 
182  default:
183  break;
184  }
185  }
186 
187  return msg;
188 }
189 
190 
192 {
193  WS_DATA_ITEM* item;
194  LOCALE_IO toggle;
195 
196  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
197  {
198  if( token == T_LEFT )
199  token = NextTok();
200 
201  if( token == T_page_layout )
202  continue;
203 
204  switch( token )
205  {
206  case T_setup: // Defines default values for graphic items
207  parseSetup( aLayout );
208  break;
209 
210  case T_line:
212  parseGraphic( item );
213  aLayout->Append( item );
214  break;
215 
216  case T_rect:
217  item = new WS_DATA_ITEM( WS_DATA_ITEM::WS_RECT );
218  parseGraphic( item );
219  aLayout->Append( item );
220  break;
221 
222  case T_polygon:
223  item = new WS_DATA_ITEM_POLYGONS();
225  aLayout->Append( item );
226  break;
227 
228  case T_bitmap:
229  item = new WS_DATA_ITEM_BITMAP( NULL );
230  parseBitmap( (WS_DATA_ITEM_BITMAP*) item );
231  aLayout->Append( item );
232  break;
233 
234  case T_tbtext:
235  NeedSYMBOLorNUMBER();
236  item = new WS_DATA_ITEM_TEXT( convertLegacyVariableRefs( FromUTF8() ) );
237  parseText( (WS_DATA_ITEM_TEXT*) item );
238  aLayout->Append( item );
239  break;
240 
241  default:
242  Unexpected( CurText() );
243  break;
244  }
245  }
246 }
247 
248 
250 {
251  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
252  {
253  switch( token )
254  {
255  case T_LEFT:
256  break;
257 
258  case T_linewidth:
259  aLayout->m_DefaultLineWidth = parseDouble();
260  NeedRIGHT();
261  break;
262 
263  case T_textsize:
264  aLayout->m_DefaultTextSize.x = parseDouble();
265  aLayout->m_DefaultTextSize.y = parseDouble();
266  NeedRIGHT();
267  break;
268 
269  case T_textlinewidth:
270  aLayout->m_DefaultTextThickness = parseDouble();
271  NeedRIGHT();
272  break;
273 
274  case T_left_margin:
275  aLayout->SetLeftMargin( parseDouble() );
276  NeedRIGHT();
277  break;
278 
279  case T_right_margin:
280  aLayout->SetRightMargin( parseDouble() );
281  NeedRIGHT();
282  break;
283 
284  case T_top_margin:
285  aLayout->SetTopMargin( parseDouble() );
286  NeedRIGHT();
287  break;
288 
289  case T_bottom_margin:
290  aLayout->SetBottomMargin( parseDouble() );
291  NeedRIGHT();
292  break;
293 
294  default:
295  Unexpected( CurText() );
296  break;
297  }
298  }
299 
300  // The file is well-formed. If it has no further items, then that's the way the
301  // user wants it.
302  aLayout->AllowVoidList( true );
303 }
304 
305 
307 {
308  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
309  {
310  if( token == T_LEFT )
311  token = NextTok();
312 
313  switch( token )
314  {
315  case T_comment:
316  NeedSYMBOLorNUMBER();
317  aItem->m_Info = FromUTF8();
318  NeedRIGHT();
319  break;
320 
321  case T_pos:
322  parseCoordinate( aItem->m_Pos );
323  break;
324 
325  case T_name:
326  NeedSYMBOLorNUMBER();
327  aItem->m_Name = FromUTF8();
328  NeedRIGHT();
329  break;
330 
331  case T_option:
332  readOption( aItem );
333  break;
334 
335  case T_pts:
336  parsePolyOutline( aItem );
337  aItem->CloseContour();
338  break;
339 
340  case T_rotate:
341  aItem->m_Orient = parseDouble();
342  NeedRIGHT();
343  break;
344 
345  case T_repeat:
346  aItem->m_RepeatCount = parseInt( -1, 100 );
347  NeedRIGHT();
348  break;
349 
350  case T_incrx:
351  aItem->m_IncrementVector.x = parseDouble();
352  NeedRIGHT();
353  break;
354 
355  case T_incry:
356  aItem->m_IncrementVector.y = parseDouble();
357  NeedRIGHT();
358  break;
359 
360  case T_linewidth:
361  aItem->m_LineWidth = parseDouble();
362  NeedRIGHT();
363  break;
364 
365  default:
366  Unexpected( CurText() );
367  break;
368  }
369  }
370 
371  aItem->SetBoundingBox();
372 }
373 
375 {
376  DPOINT corner;
377 
378  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
379  {
380  if( token == T_LEFT )
381  token = NextTok();
382 
383  switch( token )
384  {
385  case T_xy:
386  corner.x = parseDouble();
387  corner.y = parseDouble();
388  aItem->AppendCorner( corner );
389  NeedRIGHT();
390  break;
391 
392  default:
393  Unexpected( CurText() );
394  break;
395  }
396  }
397 }
398 
399 
401 {
402  BITMAP_BASE* image = new BITMAP_BASE;
403  aItem->m_ImageBitmap = image;
404 
405  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
406  {
407  if( token == T_LEFT )
408  token = NextTok();
409 
410  switch( token )
411  {
412  case T_name:
413  NeedSYMBOLorNUMBER();
414  aItem->m_Name = FromUTF8();
415  NeedRIGHT();
416  break;
417 
418  case T_pos:
419  parseCoordinate( aItem->m_Pos );
420  break;
421 
422  case T_repeat:
423  aItem->m_RepeatCount = parseInt( -1, 100 );
424  NeedRIGHT();
425  break;
426 
427  case T_incrx:
428  aItem->m_IncrementVector.x = parseDouble();
429  NeedRIGHT();
430  break;
431 
432  case T_incry:
433  aItem->m_IncrementVector.y = parseDouble();
434  NeedRIGHT();
435  break;
436 
437  case T_linewidth:
438  aItem->m_LineWidth = parseDouble();
439  NeedRIGHT();
440  break;
441 
442  case T_scale:
443  aItem->m_ImageBitmap->SetScale( parseDouble() );
444  NeedRIGHT();
445  break;
446 
447  case T_pngdata:
448  readPngdata( aItem );
449  break;
450 
451  case T_option:
452  readOption( aItem );
453  break;
454 
455  default:
456  Unexpected( CurText() );
457  break;
458  }
459  }
460 }
461 
463 {
464  std::string tmp;
465 
466  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
467  {
468  if( token == T_LEFT )
469  token = NextTok();
470 
471  switch( token )
472  {
473  case T_data:
474  NeedSYMBOLorNUMBER();
475  tmp += CurStr();
476  tmp += "\n";
477  NeedRIGHT();
478  break;
479 
480  default:
481  Unexpected( CurText() );
482  break;
483  }
484  }
485 
486  tmp += "EndData";
487 
488  wxString msg;
489  STRING_LINE_READER str_reader( tmp, wxT("Png kicad_wks data") );
490 
491  if( ! aItem->m_ImageBitmap->LoadData( str_reader, msg ) )
492  wxLogMessage(msg);
493 }
494 
495 
497 {
498  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
499  {
500  switch( token )
501  {
502  case T_page1only: aItem->SetPage1Option( FIRST_PAGE_ONLY ); break;
503  case T_notonpage1: aItem->SetPage1Option( SUBSEQUENT_PAGES ); break;
504  default: Unexpected( CurText() ); break;
505  }
506  }
507 }
508 
509 
511 {
512  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
513  {
514  if( token == T_LEFT )
515  token = NextTok();
516  else
517  {
518  // If another token than T_LEFT is read here, this is an error
519  // however, due to a old bug in kicad, the token T_end can be found
520  // without T_LEFT in a very few .wks files (perhaps only one in a demo).
521  // So this ugly hack disables the error detection.
522  if( token != T_end )
523  Unexpected( CurText() );
524  }
525 
526  switch( token )
527  {
528  case T_comment:
529  NeedSYMBOLorNUMBER();
530  aItem->m_Info = FromUTF8();
531  NeedRIGHT();
532  break;
533 
534  case T_option:
535  readOption( aItem );
536  break;
537 
538  case T_name:
539  NeedSYMBOLorNUMBER();
540  aItem->m_Name = FromUTF8();
541  NeedRIGHT();
542  break;
543 
544  case T_start:
545  parseCoordinate( aItem->m_Pos );
546  break;
547 
548  case T_end:
549  parseCoordinate( aItem->m_End );
550  break;
551 
552  case T_repeat:
553  aItem->m_RepeatCount = parseInt( -1, 100 );
554  NeedRIGHT();
555  break;
556 
557  case T_incrx:
558  aItem->m_IncrementVector.x = parseDouble();
559  NeedRIGHT();
560  break;
561 
562  case T_incry:
563  aItem->m_IncrementVector.y = parseDouble();
564  NeedRIGHT();
565  break;
566 
567  case T_linewidth:
568  aItem->m_LineWidth = parseDouble();
569  NeedRIGHT();
570  break;
571 
572  default:
573  Unexpected( CurText() );
574  break;
575  }
576  }
577 }
578 
579 
581 {
582  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
583  {
584  if( token == T_LEFT )
585  token = NextTok();
586 
587  switch( token )
588  {
589  case T_comment:
590  NeedSYMBOLorNUMBER();
591  aItem->m_Info = FromUTF8();
592  NeedRIGHT();
593  break;
594 
595  case T_option:
596  readOption( aItem );
597  break;
598 
599  case T_name:
600  NeedSYMBOLorNUMBER();
601  aItem->m_Name = FromUTF8();
602  NeedRIGHT();
603  break;
604 
605  case T_pos:
606  parseCoordinate( aItem->m_Pos );
607  break;
608 
609  case T_repeat:
610  aItem->m_RepeatCount = parseInt( -1, 100 );
611  NeedRIGHT();
612  break;
613 
614  case T_incrx:
615  aItem->m_IncrementVector.x = parseDouble();
616  NeedRIGHT();
617  break;
618 
619  case T_incry:
620  aItem->m_IncrementVector.y = parseDouble();
621  NeedRIGHT();
622  break;
623 
624  case T_incrlabel:
625  aItem->m_IncrementLabel = parseInt(INT_MIN, INT_MAX);
626  NeedRIGHT();
627  break;
628 
629  case T_maxlen:
630  aItem->m_BoundingBoxSize.x = parseDouble();
631  NeedRIGHT();
632  break;
633 
634  case T_maxheight:
635  aItem->m_BoundingBoxSize.y = parseDouble();
636  NeedRIGHT();
637  break;
638 
639  case T_font:
640  for( token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
641  {
642  switch( token )
643  {
644  case T_LEFT:
645  break;
646 
647  case T_bold:
648  aItem->m_Bold = true;
649  break;
650 
651  case T_italic:
652  aItem->m_Italic = true;
653  break;
654 
655  case T_size:
656  aItem->m_TextSize.x = parseDouble();
657  aItem->m_TextSize.y = parseDouble();
658  NeedRIGHT();
659  break;
660 
661  case T_linewidth:
662  aItem->m_LineWidth = parseDouble();
663  NeedRIGHT();
664  break;
665 
666  default:
667  Unexpected( CurText() );
668  break;
669  }
670  }
671  break;
672 
673  case T_justify:
674  for( token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
675  {
676  switch( token )
677  {
678  case T_center:
681  break;
682 
683  case T_left:
685  break;
686 
687  case T_right:
689  break;
690 
691  case T_top:
693  break;
694 
695  case T_bottom:
697  break;
698 
699  default:
700  Unexpected( CurText() );
701  break;
702  }
703  }
704  break;
705 
706  case T_rotate:
707  aItem->m_Orient = parseDouble();
708  NeedRIGHT();
709  break;
710 
711  default:
712  Unexpected( CurText() );
713  break;
714  }
715  }
716 }
717 
718 // parse an expression like " 25 1 ltcorner)"
720 {
721  aCoord.m_Pos.x = parseDouble();
722  aCoord.m_Pos.y = parseDouble();
723 
724  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
725  {
726  switch( token )
727  {
728  case T_ltcorner: aCoord.m_Anchor = LT_CORNER; break;
729  case T_lbcorner: aCoord.m_Anchor = LB_CORNER; break;
730  case T_rbcorner: aCoord.m_Anchor = RB_CORNER; break;
731  case T_rtcorner: aCoord.m_Anchor = RT_CORNER; break;
732  default: Unexpected( CurText() ); break;
733  }
734  }
735 }
736 
737 int PAGE_LAYOUT_READER_PARSER::parseInt( int aMin, int aMax )
738 {
739  T token = NextTok();
740 
741  if( token != T_NUMBER )
742  Expecting( T_NUMBER );
743 
744  int val = atoi( CurText() );
745 
746  if( val < aMin )
747  val = aMin;
748  else if( val > aMax )
749  val = aMax;
750 
751  return val;
752 }
753 
754 
756 {
757  T token = NextTok();
758 
759  if( token != T_NUMBER )
760  Expecting( T_NUMBER );
761 
762  double val = strtod( CurText(), NULL );
763 
764  return val;
765 }
766 
767 // defaultPageLayout is the default page layout description
768 // using the S expr.
769 // see page_layout_default_shape.cpp
770 extern const char defaultPageLayout[];
771 
773 {
774  SetPageLayout( defaultPageLayout, false, wxT( "default page" ) );
775 }
776 
777 // Returns defaultPageLayout as a string;
779 {
780  return wxString( defaultPageLayout );
781 }
782 
783 // emptyPageLayout is a "empty" page layout description
784 // there is a 0 length line to fool something somewhere.
785 // using the S expr.
786 // see page_layout_empty_description.cpp
787 extern const char emptyPageLayout[];
788 
790 {
791  SetPageLayout( emptyPageLayout, false, wxT( "empty page" ) );
792 }
793 
794 
796 {
797  return wxString( emptyPageLayout );
798 }
799 
800 
801 void WS_DATA_MODEL::SetPageLayout( const char* aPageLayout, bool Append, const wxString& aSource )
802 {
803  if( ! Append )
804  ClearList();
805 
806  PAGE_LAYOUT_READER_PARSER lp_parser( aPageLayout, wxT( "Sexpr_string" ) );
807 
808  try
809  {
810  lp_parser.Parse( this );
811  }
812  catch( const IO_ERROR& ioe )
813  {
814  wxLogMessage( ioe.What() );
815  }
816 }
817 
818 
819 void WS_DATA_MODEL::SetPageLayout( const wxString& aFullFileName, bool Append )
820 {
821  wxString fullFileName = aFullFileName;
822 
823  if( !Append )
824  {
825  if( fullFileName.IsEmpty() )
826  wxGetEnv( wxT( "KICAD_WKSFILE" ), &fullFileName );
827 
828  if( fullFileName.IsEmpty() || !wxFileExists( fullFileName ) )
829  {
830  #if 0
831  if( !fullFileName.IsEmpty() )
832  wxLogMessage( wxT( "Page layout file <%s> not found" ), fullFileName.GetData() );
833  #endif
835  return;
836  }
837  }
838 
839  wxFile wksFile( fullFileName );
840 
841  if( ! wksFile.IsOpened() )
842  {
843  if( !Append )
845  return;
846  }
847 
848  int filelen = wksFile.Length();
849  char * buffer = new char[filelen+10];
850 
851  if( wksFile.Read( buffer, filelen ) != filelen )
852  wxLogMessage( _("The file \"%s\" was not fully read"), fullFileName.GetData() );
853  else
854  {
855  buffer[filelen]=0;
856 
857  if( ! Append )
858  ClearList();
859 
860  PAGE_LAYOUT_READER_PARSER pl_parser( buffer, fullFileName );
861 
862  try
863  {
864  pl_parser.Parse( this );
865  }
866  catch( const IO_ERROR& ioe )
867  {
868  wxLogMessage( ioe.What() );
869  }
870  }
871 
872  delete[] buffer;
873 }
wxString m_Name
Definition: ws_data_item.h:111
WS_DATA_MODEL handles the graphic items list to draw/plot the frame and title block.
Definition: ws_data_model.h:39
void parseText(WS_DATA_ITEM_TEXT *aItem)
parse a text item starting by "(tbtext" and read parameters.
void parseCoordinate(POINT_COORD &aCoord)
int parseInt(int aMin, int aMax)
Function parseInt parses an integer and constrains it between two values.
Work sheet structure type definitions.
Definition: ws_data_item.h:93
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: common.h:216
const char emptyPageLayout[]
void AppendCorner(const DPOINT &aCorner)
add a corner in corner list
Definition: ws_data_item.h:237
void Parse(WS_DATA_MODEL *aLayout)
void SetScale(double aScale)
Definition: bitmap_base.h:93
static double parseDouble(LINE_READER &aReader, const char *aLine, const char **aOutput=NULL)
Parses an ASCII point string with possible leading whitespace into a double precision floating point ...
BITMAP_BASE * m_ImageBitmap
Definition: ws_data_item.h:366
POINT_COORD m_End
Definition: ws_data_item.h:116
void SetPage1Option(PAGE_OPTION aChoice)
Definition: ws_data_item.h:154
void SetPageLayout(const wxString &aFullFileName=wxEmptyString, bool Append=false)
Populates the list with a custom layout, or the default layout, if no custom layout available.
double parseDouble()
Function parseDouble parses a double.
static wxString EmptyLayout()
Returns a string containing the empty layout shape.
wxString m_Info
Definition: ws_data_item.h:113
DSIZE m_DefaultTextSize
Definition: ws_data_model.h:56
EDA_TEXT_HJUSTIFY_T m_Hjustify
Definition: ws_data_item.h:304
PAGE_LAYOUT_READER_PARSER(const char *aLine, const wxString &aSource)
void ClearList()
erase the list of items
This class handle bitmap images in KiCad.
Definition: bitmap_base.h:51
const char defaultPageLayout[]
void readPngdata(WS_DATA_ITEM_BITMAP *aItem)
void CloseContour()
Closes the current contour, by storing the index of the last corner of the current polygon in m_polyI...
Definition: ws_data_item.h:246
void AllowVoidList(bool Allow)
In Kicad applications, a page layout description is needed So if the list is empty,...
#define NULL
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
wxString convertLegacyVariableRefs(const wxString &aTextbase)
DPOINT m_Pos
Definition: ws_data_item.h:71
void SetLeftMargin(double aMargin)
Definition: ws_data_model.h:85
void SetTopMargin(double aMargin)
Definition: ws_data_model.h:91
EDA_TEXT_VJUSTIFY_T m_Vjustify
Definition: ws_data_item.h:305
void parsePolyOutline(WS_DATA_ITEM_POLYGONS *aItem)
parse a list of corners starting by "( pts" and read coordinates.
PAGE_LAYOUT_READER_PARSER holds data and functions pertinent to parsing a S-expression file for a WS_...
A coordinate point The position is always relative to the corner anchor Note the coordinate is from t...
Definition: ws_data_item.h:68
void parseBitmap(WS_DATA_ITEM_BITMAP *aItem)
parse a bitmap item starting by "( bitmap" and read parameters.
static int parseInt(LINE_READER &aReader, const char *aLine, const char **aOutput=NULL)
Parse an ASCII integer string with possible leading whitespace into an integer and updates the pointe...
DPOINT m_IncrementVector
Definition: ws_data_item.h:119
static wxString DefaultLayout()
Returns a string containing the empty layout shape.
double m_LineWidth
Definition: ws_data_item.h:117
void SetBottomMargin(double aMargin)
Definition: ws_data_model.h:94
void readOption(WS_DATA_ITEM *aItem)
double m_DefaultLineWidth
Definition: ws_data_model.h:55
#define _(s)
Definition: 3d_actions.cpp:33
bool LoadData(LINE_READER &aLine, wxString &aErrorMsg)
Load an image data saved by SaveData (png, in Hexadecimal form)
double m_DefaultTextThickness
Definition: ws_data_model.h:57
void Append(WS_DATA_ITEM *aItem)
void SetBoundingBox()
calculate the bounding box of the set polygons
void parseGraphic(WS_DATA_ITEM *aItem)
parse a graphic item starting by "(line" or "(rect" and read parameters.
int m_IncrementLabel
Definition: ws_data_item.h:121
void parsePolygon(WS_DATA_ITEM_POLYGONS *aItem)
parse a polygon item starting by "( polygon" and read parameters.
POINT_COORD m_Pos
Definition: ws_data_item.h:115
STRING_LINE_READER is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:254
void parseSetup(WS_DATA_MODEL *aLayout)
void SetRightMargin(double aMargin)
Definition: ws_data_model.h:88
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76